Forum rules - please read before posting.

Prevent Menu states from being saved in Savefile?

Unity: 5.5.0f3 Personal
AC: 1.55c
Unity UI Menus via Prefabs.
----

Been pulling my hair out on this one...

Is there a way to prevent Menu's from saving to the SaveFile?

It looks like when a game save is saved, any active (turned on) Menus are added to the save file. This is great for certain menus, but when I Load a game, I DON'T want those menus to be turned on.

At the moment, when I Load a game, the Menus I had open during the save (That were blocking gameplay), end up being turned on again. They contain custom animations to bring them into the screen, but because the animations weren't playing, they're out of view and "Brick" the game, so to speak.

Realistically speaking, I'd like it so that when I Load a game, the game loads without menus. I realise the Menus, themselves are considered "Scene Objects" because they carry Constant ID's, but I'm not sure what to do... I guess I could add "Remember Animation" and "Remember Transform" as well, and force the user to back out of the Menu, but I find that un-intuitive for the user.

Thank you!

Comments

  • You don't want to go about adding Remember scripts for the Menus - though present in the scene (if using Unity UI), AC's Menus are controlled separately.  Adding save scripts will create a conflict.

    Whenever a game is saved, AC will include the locked and enabled state of its Menus in the file. However, you can change what happens upong loading by running an ActionList after the game is loaded that uses a series of Menu: Change state Actions to set up the Menus exactly how you want them.  Such an ActionList can be assigned in your Load Menu's SavesList element properties.
  • I figured I'd have to do something like that.  Thank you for confirming.

    I currently have "Load when click on?" turned off so I can have a "Confirm" dialog for Loading games. I'll have to find a different way of running ActionLists after the game loads, because after using the Load Action, the game stops processing the Action List (As expected, because of a scene transition.)

    Guess I'll look into some Event hooking in a custom script, or add something to OnLoad each time.

    Thank you again! I really appreciate all your help.
  • Ah, I see.  Yes, there's an named OnFinishLoading, which will run after any necessary scene change, so that should be safe to hook an ActionList from.
  • Yup! I found that last night, and hooked it up to one of my "DoNotDestroy" prefabs that survives scene changes.

    I tried hooking it up to a static scene object, but the object wasn't initialised (I was using OnStart) in time to catch the hook before the "OnFinishedLoading" hook was called.  So if anyone else tries that hook, and it wasn't working, try attaching it to a static object that survives scene changes.
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.