public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { IndexedItemAttribute indexedItem = attribute as IndexedItemAttribute; if (coreData == null) { foreach (string guid in AssetDatabase.FindAssets("t: CoreData")) { coreData = AssetDatabase.LoadAssetAtPath <CoreData>(AssetDatabase.GUIDToAssetPath(guid)); } } switch (indexedItem.type) { case IndexedItemAttribute.IndexedItemType.SCRIPTS: property.intValue = EditorGUI.IntPopup(position, property.intValue, coreData.GetScriptNames(), null); break; case IndexedItemAttribute.IndexedItemType.STATES: property.intValue = EditorGUI.IntPopup(position, property.intValue, coreData.GetStateNames(), null); break; } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { //get the attricbut since it contains the range of the slider IndexedItemAttribute indexedItem = attribute as IndexedItemAttribute; if (coreData == null) { foreach (string guid in AssetDatabase.FindAssets("t: CoreData"))//looks at whole project for assets tagged CoreData { coreData = AssetDatabase.LoadAssetAtPath <CoreData>(AssetDatabase.GUIDToAssetPath(guid)); } } switch (indexedItem.type) { case IndexedItemAttribute.IndexedItemType.SCRIPTS: property.intValue = EditorGUI.IntPopup(position, property.intValue, coreData.GetScriptNames(), null); break; case IndexedItemAttribute.IndexedItemType.STATES: property.intValue = EditorGUI.IntPopup(position, property.intValue, coreData.GetStateNames(), null); break; case IndexedItemAttribute.IndexedItemType.RAW_INPUTS: //property.intValue = EditorGUI.Popup(position, property.intValue, coreData.GetRawInputNames(), EditorStyles.miniButtonLeft); property.intValue = EditorGUI.IntPopup(position, property.intValue, coreData.GetRawInputNames(), null); break; case IndexedItemAttribute.IndexedItemType.CHAIN_COMMAND: //property.intValue = EditorGUI.IntPopup(position, property.intValue, coreData.GetChainCommandNames(), null); break; case IndexedItemAttribute.IndexedItemType.COMMAND_STATES: property.intValue = EditorGUI.IntPopup(position, property.intValue, coreData.GetCommandStateNames(), null); break; } //base.OnGUI(position, property, label); }