Issue when loading a game

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
warhammer9485
Posts: 6
Joined: Mon Jul 18, 2022 7:27 pm

Issue when loading a game

Post 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);
                }
            }
        }    
    }
  
Last edited by warhammer9485 on Mon Feb 06, 2023 8:19 pm, edited 1 time in total.
User avatar
Tony Li
Posts: 21954
Joined: Thu Jul 18, 2013 1:27 pm

Re: Issue when loading a game

Post by Tony Li »

Hi,

Try renaming the Start() method name to OnApplyPersistentData(). The Dialogue System Saver component will automatically call this method.
warhammer9485
Posts: 6
Joined: Mon Jul 18, 2022 7:27 pm

Re: Issue when loading a game

Post by warhammer9485 »

Nice, that solve it, Thank you
User avatar
Tony Li
Posts: 21954
Joined: Thu Jul 18, 2013 1:27 pm

Re: Issue when loading a game

Post by Tony Li »

Glad to help!
Post Reply