Reset All Variables To Initial Value

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
fl.isabela
Posts: 4
Joined: Sun Jan 20, 2019 7:06 pm

Reset All Variables To Initial Value

Post by fl.isabela »

Hi, I would like to reset all variables to their initial value when my scene is loaded. Is there a simple way to do so?
Thanks!
User avatar
Tony Li
Posts: 22032
Joined: Thu Jul 18, 2013 1:27 pm

Re: Reset All Variables To Initial Value

Post by Tony Li »

Hi,

Yes, call DialogueManager.ResetDatabase or use the equivalent visual scripting action in PlayMaker, Bolt, etc.

For example, if you put this script on a GameObject in your scene, it will reset the database:

ResetDatabaseOnStart.cs

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;
public ResetDatabaseOnStart : MonoBehaviour
{
    void Start()
    {
        DialogueManager.ResetDatabase(DatabaseResetOptions.KeepAllLoaded);
    }
}
fl.isabela
Posts: 4
Joined: Sun Jan 20, 2019 7:06 pm

Re: Reset All Variables To Initial Value

Post by fl.isabela »

Hi Tony, thanks for the reply! I'll try to implement your suggestion!
=)
Post Reply