Created
September 18, 2015 00:29
-
-
Save vicenterusso/bbf7a025d5695840b93f to your computer and use it in GitHub Desktop.
Generic boilerplate for custom inspector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEditor; | |
using UnityEngine; | |
[CustomEditor(typeof(MyScript))] | |
public class MyScriptEditor : Editor | |
{ | |
private MyScript _script; | |
void OnEnable() | |
{ | |
_script = (MyScript)target; | |
} | |
public override void OnInspectorGUI() | |
{ | |
//DrawDefaultInspector(); | |
if (GUI.changed) | |
{ | |
EditorUtility.SetDirty(_script); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment