private void OnEnable() { //serializedObject.FindProperty("variablesList").objectReferenceValue if (__variablesReordableList == null) { SerializedProperty variableListSerialized = serializedObject.FindProperty("variablesList"); typesCustom = ((BlackboardCustom)serializedObject.targetObject).typesCustom; if (typesCustom == null) { typesCustom = ((BlackboardCustom)serializedObject.targetObject).typesCustom = new List <Type> (); } __variablesReordableList = new ReorderableList(serializedObject, variableListSerialized, true, true, true, true); __variablesReordableList.drawElementCallback = onDrawElement; __variablesReordableList.onAddDropdownCallback = onAddDropdownCallback; __variablesReordableList.drawHeaderCallback = onDrawHeaderElement; __variablesReordableList.onRemoveCallback = onRemoveCallback; __variablesReordableList.onSelectCallback = onSelectCallback; __variablesReordableList.elementHeight = 32f; genericMenu = EditorGUILayoutEx.GeneraterGenericMenu <Type> (EditorGUILayoutEx.unityTypesDisplayOptions, EditorGUILayoutEx.unityTypes, onTypeSelection); fillMenuCustomTypes(); } }
void CreateGenericMenu() { menu = EditorGUILayoutEx.GeneraterGenericMenu <Type> (EditorGUILayoutEx.unityTypesDisplayOptions, EditorGUILayoutEx.unityTypes, onTypeSelection); menu.AddSeparator(string.Empty); menu.AddItem(new GUIContent("Any UnityVariable"), false, (userData) => { AddUnityVariableOfTypeToList("UniUnityVar", (Type)userData, new UniUnityVariablePropertyDrawer()); }, typeof(float) ); // Type[] derivedTypes = EditorUtilityEx.GetDerivedTypes (typeof(System.Object)); // int i = 0; // Type typeUnityObject = typeof(UnityEngine.Object); // for (i = 0; i < derivedTypes.Length; i++) { // // if (!derivedTypes [i].IsSubclassOf (typeUnityObject)) { // string text2 = derivedTypes [i].ToString (); // menu.AddItem (new GUIContent ("Custom Object/" + text2.Replace ('.', '/')), _typeNameSelected == text2, onTypeCustomSelected, derivedTypes [i]); // } // } menu.AddSeparator(string.Empty); menu.AddItem(new GUIContent("Reload"), false, delegate { CreateGenericMenu(); }); menu.AddSeparator(string.Empty); // menu.AddItem (new GUIContent ("Global Blackboard"), false, delegate { // Debug.LogWarning ("Not implemented"); // //EditorApplication.ExecuteMenuItem ("Tools/Global Blackboard"); // }); }