Custom Inspector Inspector

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
m (make the code snippet look like code)
m (clarify that this applies to Editor scripts, usually custom inspector ones)
Line 1: Line 1:
Put this line inside your 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>
 
<csharp>EditorGUILayout.ObjectField(new GUIContent("Custom Editor Script"), AssetDatabase.LoadAssetAtPath("Assets/Editor/" + GetType().Name + ".cs", typeof(MonoScript)), typeof(MonoScript));</csharp>

Revision as of 10:48, 28 December 2011

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>


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