Remember UI when exiting playmode
I'm building a simple animatic tool that allows me to overlay a video as a UI image on screen, along with some scale and transparency controls. I'm using a scriptable object to hold the current scale/alpha settings, so if they are changed during runtime and a new scene is loaded, they hold the same values into the next scene load. The scriptable object settings are loaded on start(), and can be affected by some UI buttons. They can also be edited on the parent component using inspector buttons before the scene is played.
The issue I'm having is that when the scene closes, it reverts to the pre play state even though the settings are up to date in the scriptable object. I think I understand why this is happening, but wondering if there's a way to auto update the scene with the SO settings when exiting play mode. I've tried calling my methods in OnDisable() and in OnDestroy() but doesn't seem to help. Is there anyway to set this?
Answer by Dbaxter04 · Sep 29, 2020 at 09:51 AM
I managed to solve this with just by adding ExecuteInEditMode to the class. It appears that the Start() method is called when the scene exits which triggers my set methods and remembers the gameplay state.
Your answer
Follow this Question
Related Questions
Why is this List only showing one int? 0 Answers
UI attributes in ScriptableObjects not appearing. 0 Answers
UI Mask Magnifier Effect? 1 Answer
Unity3d UI ListBox Help 0 Answers