private void OnDisable() { if (mapCreator == null) { return; } serializedObject.Update(); if (!mapCreator.editGenerator.Equals(mapCreator.generator)) { if (EditorUtility.DisplayDialog("Property has changed", "What do you want?", "Apply new property", "Keep old property")) { mapCreator.ApplyEditProperty(); } else { mapCreator.RevertEditProperty(); } } if (mapCreator != null) { EditorUtility.SetDirty(mapCreator); } mapCreator.RevertEditProperty(); serializedObject.ApplyModifiedProperties(); DestroyImmediate(rTex); }
private void OnEnable() { serializedObject.Update(); mapCreator = this.target as Height2NormalMapAsset; mapCreator.RevertEditProperty(); rTex = new RenderTexture(256, 256, 0); EditorUtility.SetDirty(mapCreator); serializedObject.ApplyModifiedProperties(); }