private void OnDisable() { if (instance == this) { instance = null; } }
public IEnumerator SavingCustomVariableStruct(int expectedValue, int newValue) { //Arrange var temp = Resources.Load <TestStructCustomVariable>(StructSO); yield return(null); //Act var t = temp.Value; t.clang = newValue; t.cpp = newValue; t.csharp = newValue; temp.Value = t; UnityRuntimeHelper.onApplicationFocusLost(); yield return(null); temp.Reset(); Resources.UnloadAsset(temp); temp = Resources.Load <TestStructCustomVariable>(StructSO); yield return(null); //Assert Assert.IsTrue(temp.AutoSave); Assert.AreEqual(expectedValue, temp.Value.clang); Assert.AreEqual(expectedValue, temp.Value.cpp); Assert.AreEqual(expectedValue, temp.Value.csharp); Assert.IsNotNull(temp); }
private void OnEnable() { if (instance == null) { instance = this; EditorApplication.playModeStateChanged += this.OnEditorApplicationOnplayModeStateChanged; } else { Destroy(this); } }