public override void OnGUI(Rect position, SerializedProperty a_Property, GUIContent a_Label) { position.height = EditorHelp.c_LineHeight; EditorGUI.BeginProperty(position, a_Label, a_Property); SerializedProperty foldOutProperty = a_Property.FindPropertyRelative("m_IsFoldingOut"); SerializedProperty prefabProperty = a_Property.FindPropertyRelative("m_AbilityModulePrefab"); AbilityModule prefab = null; string nameString = "Ability slot empty"; if (prefabProperty.objectReferenceValue != null) { prefab = prefabProperty.objectReferenceValue as AbilityModule; nameString = prefab.GetName(); } foldOutProperty.boolValue = EditorGUI.Foldout(position, foldOutProperty.boolValue, nameString, true); Rect pos = position; if (foldOutProperty.boolValue) { EditorGUI.indentLevel++; EditorHelp.PropertyDrawerLineWithVar(a_Property, "m_AbilityModulePrefab", ref pos, "", "Prefab"); if (prefabProperty.objectReferenceValue != null) { if (EditorHelp.PropertyDrawerButton("Edit", ref pos)) { Selection.activeGameObject = prefab.gameObject; } } EditorGUI.indentLevel--; } EditorGUI.EndProperty(); }
void FixedUpdate() { if (m_AbilityModuleManager != null) { AbilityModule module = m_AbilityModuleManager.GetCurrentModule(); if (module != null) { m_TextMesh.text = module.GetName(); } else { m_TextMesh.text = "Default"; } } }