Custom Inspector Inspector

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
m (clarify that this applies to Editor scripts, usually custom inspector ones)
m (Text replace - "<csharp>" to "<syntaxhighlight lang="csharp">")
Line 1: Line 1:
 
Put this line inside your custom inspector/editor script's OnInspector() somewhere:
 
Put this line inside your custom inspector/editor script's OnInspector() somewhere:
  
<csharp>EditorGUILayout.ObjectField(new GUIContent("Custom Editor Script"), AssetDatabase.LoadAssetAtPath("Assets/Editor/" + GetType().Name + ".cs", typeof(MonoScript)), typeof(MonoScript));</csharp>
+
<syntaxhighlight lang="csharp">EditorGUILayout.ObjectField(new GUIContent("Custom Editor Script"), AssetDatabase.LoadAssetAtPath("Assets/Editor/" + GetType().Name + ".cs", typeof(MonoScript)), typeof(MonoScript));</csharp>
  
  
 
Now, by clicking this control, you can go directly from looking at a custom inspector you are making, to editing the script of that custom inspector (which can otherwise require a lot of scrolling to find in your Project pane).
 
Now, by clicking this control, you can go directly from looking at a custom inspector you are making, to editing the script of that custom inspector (which can otherwise require a lot of scrolling to find in your Project pane).

Revision as of 19:25, 10 January 2012

Put this line inside your custom inspector/editor script's OnInspector() somewhere:

EditorGUILayout.ObjectField(new GUIContent("Custom Editor Script"), AssetDatabase.LoadAssetAtPath("Assets/Editor/" + GetType().Name + ".cs", typeof(MonoScript)), typeof(MonoScript));</csharp>
 
 
Now, by clicking this control, you can go directly from looking at a custom inspector you are making, to editing the script of that custom inspector (which can otherwise require a lot of scrolling to find in your Project pane).
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox