private void DrawRuntimeObject(Rect position, RuntimeSerializedObject runtimeSerializedObject) { var prop = runtimeSerializedObject.GetIterator(); var height = RuntimeEasyGUI.GetSinglePropertyHeight(prop, new GUIContent(prop.DisplayName)); var headerPosition = new Rect(position.x, position.y, position.width, height); headerPosition.xMin += Space; prop.IsExpanded = EditorGUI.Foldout(headerPosition, prop.IsExpanded, prop.DisplayName); RuntimeEasyGUI.PropertyField(headerPosition, prop, null); if (prop.IsExpanded) { var y = RuntimeEasyGUI.GetPropertyHeight(prop, null); EditorGUI.indentLevel++; while (prop.NextVisible(false)) { var mainPosition = new Rect(position.x, position.y + y, position.width, height); mainPosition.xMin += Space; height = RuntimeEasyGUI.GetPropertyHeight(prop, new GUIContent(prop.DisplayName), prop.IsExpanded, null); RuntimeEasyGUI.PropertyField(mainPosition, prop, new GUIContent(prop.DisplayName), prop.IsExpanded, null); y += height; } EditorGUI.indentLevel--; } }
private float GetRuntimeObjectHeight(RuntimeSerializedObject runtimeSerializedObject) { var height = 0f; var prop = runtimeSerializedObject.GetIterator(); height += RuntimeEasyGUI.GetSinglePropertyHeight(prop, new GUIContent(prop.DisplayName)); if (prop.IsExpanded) { while (prop.NextVisible(false)) { height += RuntimeEasyGUI.GetPropertyHeight(prop, new GUIContent(prop.DisplayName), prop.IsExpanded, null); } } return(height); }