Page 1 of 1

Issue when loading a game

Posted: Mon Feb 06, 2023 6:41 pm
by warhammer9485
Hello everyone.

I'm have an issue when i load a saved game here is a video of the issue.


What happens is that, after saving then restarting unity and loading the game, the scene changes to day time, and that should not happen. I don't know where if the issue is with the save system(i'm using the save system that comes with the DS) on how it load the game. Each scene in the game has a manager that activates o deactivates the light and other game objects. it acces the variable "Dormir" that is used to set the scene to night.

So far i have tried to change the code to Awake and modifying the script execution order with out any fix. So i'm really stuck with this problem.

Here's part of the Scene Manager Code that controlls the lights

Code: Select all

private void Start() 
    {
        
        if(DialogueLua.GetVariable("Dormir").asBool)
        {
            if(DirectionalLight != null)
            {
                DirectionalLight.SetActive(false);
            }
           
            if(lights != null)
            {
                foreach (var light in lights)
                {
                    light.SetActive(true);
                }
            }
        }    
    }
  

Re: Issue when loading a game

Posted: Mon Feb 06, 2023 8:15 pm
by Tony Li
Hi,

Try renaming the Start() method name to OnApplyPersistentData(). The Dialogue System Saver component will automatically call this method.

Re: Issue when loading a game

Posted: Mon Feb 06, 2023 8:28 pm
by warhammer9485
Nice, that solve it, Thank you

Re: Issue when loading a game

Posted: Mon Feb 06, 2023 8:46 pm
by Tony Li
Glad to help!