Forum rules - please read before posting.

MenuManager bugs when working with Unity UI Prefabs

edited September 2023 in Engine development

Hi,

I stumbled about two bugs of the MenuManager when working with Unity UI Prefabs:

1) In the Start of the UI Prefab I call this:

Menu inventoryMenu = KickStarter.menuManager.GetMenuWithName("My Inventory");
inventoryMenu.isLocked = true;

And this changes the Start game locked off default value in the Menu Manager.
It also happens when I delay the code a second via coroutine.
No extra logic inside the UI Prefab.


2) When I change the scene via switch player (with standard ActionList):
I turn off the menu.
I lock the menu
I switch the player -> scene switch happens

The isLocked attribute of the menu (Unity UI Prefab) changes to false.
And the Menu (in my case the inventory) is again accessible.
This doesn't happen with the default Inventory of AC.

The two players have their own inventories.
No logic in the second scene.

AdventureCreator Version: 1.75.4
Unity: 2020.3.33f1

Could you please point out where I could look to make a hotfix?

Best.
Alex

Comments

  • edited September 2023

    Do both cases involve the use of scripting?

    If you access a Menu via MenuManager, you'll get the original Menu that you work with in the Editor. This is not the same as the Menu in game, which exists in the PlayerMenus class.

    Replace KickStarter.menuManager with PlayerMenus, and you'll access the "runtime" variant - leaving the Menu Manager alone, and only affecting the Menu in Play mode.

    For more details on working with Menus through script, see the Manual's "Menu scripting" chapter.

  • About case 1:

    Yes I checked the ScriptReference this time :D

    But it isn't documented that it refers to the actual Editor MenuManager (at least I don't see it), so I thought yeah.. Kickstarter is for getting runtime stuff.. menuManager, got it.
    I can get the Menu and I can call TurnOff() / TurnOn(), which would lead me to the assumption that it is in fact the runtime version. It doesn't really make sense in an editor context, does it?
    I think a comment line in the Script Reference above each static property of the Kickstarter would save us (and you ;) )a lot of hassle.

    About case 2:
    I checked everything with fresh eyes.. was my fault, sorry!

    Thanks for your support.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.