When quests, variables are loaded.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Espes
Posts: 24
Joined: Sun Aug 16, 2020 12:29 pm

When quests, variables are loaded.

Post by Espes »

Hello. I want to initialize stuff on scene load, by checking quest, variables states. When to check these? In Awake, Start or there is an event that I can subscribe to e.g OnQuestLoad?
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: When quests, variables are loaded.

Post by Tony Li »

Hi,

If you want to know when the Dialogue Manager has loaded the dialogue database into memory and prepared the Lua environment, hook into DialogueManager.instance.initializationComplete:

Code: Select all

void Awake()
{
    DialogueManager.instance.initializationComplete += OnDialogueSystemReady;
}

void OnDialogueSystemReady()
{
    DialogueManager.instance.initializationComplete -= OnDialogueSystemReady;
    // (Do your thing here.)
}
If you want to know when the save system has finished loading a scene and applying saved game data, hook into SaveSystem.saveDataApplied:

Code: Select all

void Awake()
{
    // Save system may take more than one frame after scene starts to apply save data.
    // (You can configure the number of frames on the Save System GameObject.)
    SaveSystem.saveDataApplied += OnSavedDataApplied;
}

void OnSaveDataApplied()
{
    SaveSystem.saveDataApplied += OnSavedDataApplied;
    // (Do your thing here.)
}
Espes
Posts: 24
Joined: Sun Aug 16, 2020 12:29 pm

Re: When quests, variables are loaded.

Post by Espes »

Great! Thank you!
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: When quests, variables are loaded.

Post by Tony Li »

Happy to help!
Post Reply