public static void TypeEditor(this Stencil stencil, TypeHandle typeHandle, Action <TypeHandle, int> onSelection, SearcherFilter filter = null, TypeOptions options = TypeOptions.None) { var wasArray = typeHandle.IsVsArrayType(stencil); var missingTypeReference = TypeHandle.MissingType; EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Type"); var selected = EditorGUILayout.DropdownButton(new GUIContent(typeHandle != missingTypeReference ? typeHandle.GetMetadata(stencil).FriendlyName : "<unknown type>"), FocusType.Passive, GUI.skin.button); if (Event.current.type == EventType.Repaint) { s_ButtonRect = GUILayoutUtility.GetLastRect(); } if (selected) { SearcherService.ShowTypes( stencil, EditorWindow.focusedWindow.rootVisualElement.LocalToWorld(s_ButtonRect.center), (t, i) => onSelection(wasArray ? t.MakeVsArrayType(stencil) : t, i), filter ); } EditorGUILayout.EndHorizontal(); if (!options.HasFlag(TypeOptions.AllowArray)) { return; } var newIsArray = EditorGUILayout.Toggle("Is Array", wasArray); if (newIsArray != wasArray) { onSelection(newIsArray ? typeHandle.MakeVsArrayType(stencil) : typeHandle.GetVsArrayElementType(stencil), 0); } }