Custom Inspector Inspector

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "Put this line inside your OnInspector() somewhere: EditorGUILayout.ObjectField(new GUIContent("Custom Editor Script"), AssetDatabase.LoadAssetAtPath("Assets/Editor/" + GetType()...")
 
m (make the code snippet look like code)
Line 1: Line 1:
 
Put this line inside your OnInspector() somewhere:
 
Put this line inside your OnInspector() somewhere:
  
EditorGUILayout.ObjectField(new GUIContent("Custom Editor Script"), AssetDatabase.LoadAssetAtPath("Assets/Editor/" + GetType().Name + ".cs", typeof(MonoScript)), typeof(MonoScript));
+
<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 10:46, 28 December 2011

Put this line inside your OnInspector() somewhere:

<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).

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox