HideInInspector prevent EditorGUILayout.PropertyField from drawing SerializedProperty

I hid several fields (which are custom classes with tons of parameters) from showing in default editor to place them in more appropriate place in my custom editor section. I was trying to figure out why EditorGUILayout.PropertyField is not working for this field. Only after day of investigation, and when I almost finish coding my own control for drawing PropertyField I realized that [HideInInspector] is the key figure in this story.

Is such behaviour correct? It seems not, all other EditorGUILayout controls work fine with “Hidden Fields”…

Hey there,

Yes this is 100% correct behavior this is what gives you the true power of PropertyDrawers. They are there to be reusable. The fact that you can write a whole editor window and still have custom drawers take effect is very very useful. Otherwise you would have to do a lot of repeat work.

Cheers

Hi, sorry for long reply, have no time to check your statement.

Today I made a little experiment and find out that objects of custom classes, which have PropertyDrawers, are drawn by EditorGUILayout.PropertyField, even if they marked as [HideInInspector]. Hence I still consider aforementioned behaviour like “Broken One”, because it prevent us from using EditorGUILayout.PropertyField in conjunction with DrawDefaultInspector().

Cheers