I recently try to make custom looking menus following this tutorial:
https://adventurecreator.org/tutorials/creating-inventory-bar-unity-uiIt is great and informative, and I created the menu appearance. But I am not able to control it. I am using direct control and don't want to use the mouse. I can control the default Inventory Menu by keyboard direction key and Interaction A; but when the custom Inventory Menu is open, I cannot do anything with it.
Then I realize if I change the default Inventory Menu source to Unity Prefab, it also cannot be controlled. How may I solve this?
Thank you.
Comments
Full details can be found in the "Navigating menus directly" chapter of the Manual.
I checked the Auto-select first visible element and Pause game when enable, and also put an action list in ActionList when turn on that Enable Control in-game Menus. It works well when the source is set to AC, but cannot work when using Unity Ui Prefab.
Then when using source = Unity UI Prefab, if I add to the action list an action of Menu: Select element, with the Menu containing element = Inventory, and the Element to select = ShiftLeft or InventoryBox, then it gives an error:
I am using AC v1.61.2
Thanks for your help
Have you defined an Event system prefab in your Menu Manager? If not, make sure there is none in your scene file, as AC will create one automatically.
If the menu is paused, there'll be no need for any Engine: Manage systems Action - just that Directly-navigate Menus when paused? is checked at the top of the Menu Manager.
Try loading in the Demo_MenuManager asset file. Switch the Pause Menu's Source to Unity Ui Prefab (a UI Canvas will already be assigned to it), and check Auto-select first visible element?. Can that be directly-navigated when opened by pressing Escape?
But I dunno how to change the selected element's display method, such as having a green background texture (like the default AC Inventory display method), or display the Active Graphic of the item. Can you point me to the right direction?
Thanks for the help
Having the active graphic show should just be a case of defining one in the item's properties in the Inventory Manager, and checking Show Active FX when Cursor hovers over Item in Menu? in the Settings Manager.
Then I begun to customize the Subtitle menu. What I did are:
1. Created a Panel.
2. Created a Text as a child of the Panel.
3. Added a Horizontal Layout Group & a Content Size Fitter to the Panel. All the Content Size Fitter options are set to Preferred Size.
4. Added a Content Size Fitter to the Text. All the Content Size Fitter options are set to Preferred Size.
After linking the Canvas, Panel and Text in the Subtitle Menu, the subtitle text can be display in the UI elements I created.
However, both the Panel and Text are initialized with 0 size and expanded when the subtitle words roll out. I wish to have the Panel and the Text initialized to have the size of the finished subtitle, just like the default Adventure Creator Subtitle menu. How may I achieve that?
The default AC menu doesn't have the correct size to begin with - it's just large enough to accommodate it. What you're looking for isn't something that AC does.
What you could try, however, is creating a "dummy" Text component that displays the same speech text instantly (no scrolling), only with an invisible colour. That would also be a child of the Panel, and therefore expand it to the correct size.
You'd then just need a simple script that updates the Text component with the currently-spoken speech text. This can be done by hooking into the OnStartSpeech custom event:
http://pasteall.org/925786/csharp
Paste that in a new C# script named UpdateDummyText.cs, attach it to your Text component and fill in the field.
This can be solved by removing the line:
EventManager.OnStartSpeech -= GetSpeech;
But would this cause problems in the long run such as memory leak?
The necessary script will also require some tweaks made to AC itself - please bump this thread when the next update is out, and I'll see about giving you such a script.
http://pasteall.org/938101/csharp
The GetMenuWithCanvas method should be in PlayerMenus.cs, around line 2761.
But there is a Null Reference exception on line 15: Speech speech = menu.speech;. It seems it cannot find the speech menu.