Hi,
radioactivedogs wrote: ↑Sat Jul 16, 2022 11:26 am- Could I exclude a variable group from being saved?
No. (Or at least not easily.)
radioactivedogs wrote: ↑Sat Jul 16, 2022 11:26 am- Are variables created at runtime saved?
Yes. The entire table of runtime variables (including variables defined in the dialogue database) are dumped into the save data. This save data is then saved into a slot, so it's slot-specific.
I don't think Lua variables are the best place for your settings values. However, you can still make those settings values available to Lua so you can check them in Dialogue System Triggers' Conditions, in conversations, etc.
For example, say you keep those values in a C# class:
Code: Select all
[System.Serializable]
public class Settings
{
public string Platform = "";
public bool Demo = false;
public bool UsingController = false;
public bool SkipDialogue = false;
//etc.
}
public Settings settings = new Settings();
You could use PlayerPrefs to save and load it like this:
Code: Select all
PlayerPrefs.SetString("Settings", JsonUtility.ToJson(settings));
...
settings = JsonUtility.FromJson<Settings>(PlayerPrefs.GetString("Settings"));
if (settings == null) settings = new Settings();
You could also write some C# methods to get those values:
Code: Select all
public bool IsDemo { return settings.Demo; }
public bool IsUsingController { return settings.UsingController; }
public bool ShouldSkipDialogue { return settings.SkipDialogue; }
//etc.
Then you can register those methods with Lua: (
tutorial,
manual)
Code: Select all
void Awake()
{
Lua.RegisterFunction("IsDemo", this, SymbolExtensions.GetMethodInfo(() => IsDemo()));
//etc.
}
Then you can use those methods in the Dialogue System, such as:
- Dialogue Text: "I see you're playing the demo. I hope you like the game so far!"
- Conditions: IsDemo() == true