Custom Inspector Variables

Hi, I’ve been reading the Scripting Reference and Documentation on custom inspector elements such as Property Drawers and Editor stuff. Frankly, I’ve been able to make a custom editor window but that’s not something I want to achieve and I just seem to be stuck at this point.

I just want to show the variables in one of my scripts somewhat more organized in my inspector. Such as a dropdown menu if one of those things is selected I show the appropriate variable. I got this working in an editor window, so I know how the EditorGui works, but not in the inspector of the object to which the script is bound.

Like I said the Documentation didn’t really get me anywhere, so if anyone has a ‘clear’ explanation on this, that would be lovely.

You are looking for a custom editor - http://docs.unity3d.com/Documentation/Components/editor-CustomEditors.html

This will use your custom inspector’s OnGUI when showing the specified object’s inspector window.

Here is an example in c#

[CustomEditor(typeof(AssetBundleElement))]
public class AssetBundleElemetEditor : Editor
{
   protected AssetBundleElement myTarget;

   void Awake()
   {
       myTarget = (AssetBundleElement)target;
   }

   void OnInspectorGUI()
   {
       //draw your inspector here!
   }
}