GetPropertyHeight infinite recursion on drawer

Ok I found something very strange…

here they say EditorGUI.GetPropertyHeight would call GetPropertyHeight on the drawer

so in this example we should get infinite recursion (the example seems wrong)

I’m not sure about this. Am I wrong or should I report this?

Hi! I wrote the isExpanded example in the documentation, and can verify it does not cause infinite recursion.

The missing piece of information here is that when you call EditorGUI.GetPropertyHeight(), it is actually getting the height from an internal “property handler” object, which are evaluated on a stack. So inside of a custom PropertyDrawer for some type, calling EditorGUI.GetPropertyHeight() on that property will return the default height for it (which in this case is a single line for the parent property and one for each child property if the parent is expanded). It’s the same reason that example is able to call EditorGUI.PropertyField() inside its OnGUI() method without causing infinite recursion.