private bool VisitStructOrEnum <TContainer>(ref TContainer container, UTinyObject tiny, UTinyType type, int index) where TContainer : IPropertyContainer { var drawer = Mode == InspectMode.Normal && type.HasAttribute <EditorInspectorAttributes.CustomDrawerAttribute>() ? type.GetAttribute <EditorInspectorAttributes.CustomDrawerAttribute>().Visitor : s_DefaultStructVisitor; TransferState(drawer); var label = ConstructLabel(index >= 0 ? index.ToString() : tiny.Name); // We are in a list if (index >= 0) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(); } try { return(drawer.VisitStruct(tiny, label)); } finally { if (index >= 0) { EditorGUILayout.EndVertical(); if (GUILayout.Button("x", GUILayout.Width(16.0f), GUILayout.Height(16.0f))) { RemoveAtIndex = index; } EditorGUILayout.EndHorizontal(); } } }
private bool VisitComponent(UTinyObject tiny, UTinyType type) { ++EditorGUI.indentLevel; try { var editor = Mode == InspectMode.Normal && type.HasAttribute <EditorInspectorAttributes.CustomComponentEditor>() ? type.GetAttribute <EditorInspectorAttributes.CustomComponentEditor>().Visitor : s_DefaultComponentVisitor; TransferState(editor); return(editor.VisitComponent(tiny)); } finally { --EditorGUI.indentLevel; } }