private void Awake() { MyConfig.Load(); MyConfig.Loaded.Database.RegisterObjectChange("test.bool", o => { Debug.Log("Hey, A change!"); }); Debug.Log($"test.bool: {MyConfig.TestBool}"); Debug.Log($"test.string: {MyConfig.TestString}"); MyConfig.TestString += Random.Range(1, 9); MyConfig.CustomSerializable.MyString += ", Hello!"; Debug.Log("MyConfig2 ->"); MyConfig2.Load(); MyConfig2.Loaded.Database.RegisterObjectChange("TestBool", o => { Debug.Log("Hey, A change!"); }); Debug.Log($"TestBool {MyConfig2.TestBool}"); Debug.Log($"TestString: {MyConfig2.TestString}"); MyConfig2.TestString += Random.Range(1, 9); MyConfig2.CustomSerializable.MyString += ", Hello!"; Debug.Log(MyConfig2.MyEnum); }
private IEnumerator Start() { while (true) { MyConfig.Update(); MyConfig2.Update(); yield return(new WaitForEndOfFrame()); } }
private void OnApplicationQuit() { MyConfig.Save(); MyConfig2.Save(); }