How do I use an ObjectField in an custom inspector editor?

Weirdest thing. I can get these to work fine in pop up editor windows, but the exact same code just does nothing when used in an inspector editor. What do I need to do differently?

m_ResetSpot = EditorGUILayout.ObjectField( "Reset Spot: ", m_ResetSpot, typeof( Transform ) ) as Transform;

I’m writing a custom editor with buttons and displays and fancy stuff, and I want to also have a drag-a-prefab target for something to instantiate later. Like when you just do “public Transform m_ResetSpot” as a variable declaration when you don’t have a custom editor.

Well, if anyone else needs a workaround, I added a script with nothing but “public Transform m_ResetSpot” to the same object as the real script. Then in OnAwake I make the real script find this little stub and read the prefab out of it. So it shows next to my custom inspector rather than in it, but it works.

Custom inspectors aren’t officially supported–they’re in there, and you can use them at your own risk, but they aren’t an actual 2.1 feature (and I guess their API may change with 2.5).