示例#1
0
 private void OnDisable()
 {
     if (instance == this)
     {
         instance = null;
     }
 }
示例#2
0
        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);
        }
示例#3
0
 private void OnEnable()
 {
     if (instance == null)
     {
         instance = this;
         EditorApplication.playModeStateChanged += this.OnEditorApplicationOnplayModeStateChanged;
     }
     else
     {
         Destroy(this);
     }
 }