Forum rules - please read before posting.

Loading a save game doesn't show Menu changes?

[AC v1.75.8 - Unity 2021.3.11f1]

Hi Chris!

I use a Unity Prefab as source for my Pause Menu. I wanted to update such menu by enabling a button I kept disabled for a long time (a "Debug" button), I've both enabled its GameObject in the Prefab and its "Is visible?" state in the Menu manager.

When starting a new game from scratch the button is correctly visible, but it isn't when I load a save game from before I made such change to the Menu.

I tried doing all of the following:

  • resetting the button's ConstantID, retaining it into the Prefab, then reassigning it to the related Button in the Menu manager
  • resetting the Panel's ConstantID, retaining it into the prefab, then reassigning it to the related RectTransform boundary in the Menu manager

but neither worked.

Did I left something out in the process?

Thanks a lot as always,
Chris

Comments

  • If the Element's visibility is reverting to its state at the time the save was recorded, then it's working as intended: Menu and Element visibility states are recorded in save-game files.

    If you wanted to avoid this, you either:

    • Un-link it from the Menu Manager by deleting the Button element
    • Use a Global Bool variable, linked to Options Data, to keep track of what the visiblity state should be (options variables are independent of save-games) and then assign an "ActionList after loading" to set the visibility to the correct state based on its value
  • Oh, I see!

    I'm sorry if this is out of the scope for AC, but - if it's not the same as the second method you listed - what would be an ideal approach for bugfixes and\or added functionality for Menus, if one wanted to keep making use of AC's Menu manager?

  • Could you give an example of such functionality?

  • edited October 2022

    Consider all of the following cases as involving Unity Prefabs as sources!

    A scenario that came to mind is: after the release I realize I need to add an accessibility option - that wasn't there before - to my OptionsUI or an entire submenu to my PauseUI. How can I make sure that this update rolls out for all players, old and new?

    The current actual case scenario is not much of a big deal, because we're still deep into production: my PauseUI menu has a Debug button that I had eventually disabled when we released the demo for our game on Steam during a festival. Now we actually need it back, so I wanted to reenable it.

    It's ok because we don't really NEED to load previous saves (although I use them to quickly test some situations), but yeah, I started wondering about possible futures!

    I hope it's clearer now.
    Nonetheless, thanks as always!

  • Thanks for the details.

    When applying save-game data to the Menu system, only data for Menus that exist in the save-data will be affected.

    If you create a save file, and then update your UI by adding a new Menu or Element, then those additions won't be affected by loading that save file.

    If you were in a situation were you wanted to force a particular Menu or Element state after loading a save file, regardless of its data, you could do so by running an ActionList after the loading process. This can be assigned inside the SavesList menu element, or by having a script hook into the OnFinishLoading custom event.

  • Thank you!

    I shall look into the OnFinishLoading method if the case ever requires it.

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.