Hi there,
I have a Menu with a few MenuElements, which are buttons and are linked to Unity UI buttons themselves. I have those set to "When invisible, disable interactability".
I have a script that toggles MenuElement.IsVisible
of each of those buttons. I've checked that the visibility of my menu elements is correct on the "Menu" tab of the AC Game Editor. However, my UI buttons are not changing state until the next time I run my scene, which is really odd. So:
I've tried refreshing the menu with Recalculate()
& ResetVisibleElements()
but this doesn't seem to do anything at all, and I'm at a bit of a loss here. I also don't understand why things are being cached between runs.
I'm running Unity 2019.4.2f1 & AC 1.70.2
Thanks in advance!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
It sounds like you're affecting the Menus as stored in the Menu Manager, rather than the runtime copies in PlayerMenus.
Access your Menus using PlayerMenus.GetMenus or PlayerMenus.GetMenuWithName, rather than kickStarter.menuManager. If you need specific help with your script, share it here and I'll amend it for you.
You are of course completely right . I was reading it directly, and I do something similar to global variables, so I guess I should avoid the managers?
Thanks in any case, very helpful as usual!
Changes made to Manager values will be retained once you exit Play Mode. Similarly in the case of Global Variables, you can access their runtime equivalents with AC.GlobalVariables.
See the "Menu scripting" and "Variable scripting" chapters of the Manual for more details on accessing these through script.