//-------------------------------------------------------- // updates that happen in the inspector------------------- public override void OnInspectorGUI() { // set skin to normal GUI.skin = null; // Initialize playerBaseTarget to access component EnemyBase enemyBaseTarget = target as EnemyBase; //get access to 'EnemyBase.cs' // Toggle debugging display enemyBaseTarget.ShowDebugging = GUILayout.Toggle(enemyBaseTarget.ShowDebugging, "Toggle Debugging Display?"); //displays icons and other debugging info // Toggle automatic ragdoll swapping override if (enemyBaseTarget.ShowDebugging) { _overrideAutomaticRagdollSwapping = GUILayout.Toggle(_overrideAutomaticRagdollSwapping, "Override automatic Ragdoll swapping?"); } // Display buttons for overriding ragdoll swapping if (_overrideAutomaticRagdollSwapping) { ManualRagdollSwappingButtons(enemyBaseTarget); } EditorGUILayout.Separator(); // Main Tabs ------------------------------------------------ // Creates three main tabs at the top of the inspector pane CurrentTab = (MainTabType)GUILayout.Toolbar((int)CurrentTab, new string[3] { "Start", "Movement", "Animation" }); //list main tabs across the top of the editor; current tab equals the main tab clicked // Fills the tab based on current selection switch (CurrentTab) { case MainTabType.Start: StartTab(enemyBaseTarget); //Contain all necessary start-up requirements break; case MainTabType.Movement: MovementTab(enemyBaseTarget); break; case MainTabType.Animation: AnimationTab(enemyBaseTarget); break; } //----------------------------------------------------------- if (GUI.changed) //apply changes made in editor ??I think.. TODO find out more about this { EditorUtility.SetDirty(target); } }
public MainMenuTab SwitchTab(MainTabType type) { if (_lastActiveTab != null) { _lastActiveTab.gameObject.SetActive(false); } MainMenuTab desiredUI = _tabs.Find(t => t.Tab == type); if (desiredUI != null) { desiredUI.gameObject.SetActive(true); desiredUI.UpdateAll(); _lastActiveTab = desiredUI; } else { Debug.LogError("Can't find the ui object!"); } return(desiredUI); }
//-------------------------------------------------------- // updates that happen in the inspector------------------- public override void OnInspectorGUI() { // Display warning if more than one instance of 'PlayerBase' exists in the scene if (_moreThanOneCopy) { GUILayout.Label("More than one copy of PlayerBase exists in the scene", EditorStyles.notificationBackground); GUILayout.Label("Please make sure to use only one copy of 'PlayerBase' > check Console for details", EditorStyles.miniLabel); return; } // set skin to normal GUI.skin = null; // Initialize playerBaseTarget to access component PlayerBase playerBaseTarget = target as PlayerBase; //get access to 'PlayerBase.cs' // Toggle debugging display playerBaseTarget.ShowDebugging = GUILayout.Toggle(playerBaseTarget.ShowDebugging, "Toggle Debugging Display?"); //displays icons and other debugging info // Toggle automatic ragdoll swapping override if (playerBaseTarget.ShowDebugging) { _overrideAutomaticRagdollSwapping = GUILayout.Toggle(_overrideAutomaticRagdollSwapping, "Override automatic Ragdoll swapping?"); } // Display buttons for overriding ragdoll swapping if (_overrideAutomaticRagdollSwapping) { ManualRagdollSwappingButtons(playerBaseTarget); } EditorGUILayout.Separator(); // Main Tabs ------------------------------------------------ // Creates three main tabs at the top of the inspector pane CurrentTab = (MainTabType)GUILayout.Toolbar((int)CurrentTab, new string[3] { "Start", "Movement", "Animation" }); //list main tabs across the top of the editor; current tab equals the main tab clicked // Fills the tab based on current selection switch (CurrentTab) { case MainTabType.Start: StartTab(playerBaseTarget); //Contain all necessary start-up requirements break; case MainTabType.Movement: MovementTab(playerBaseTarget); break; case MainTabType.Animation: AnimationTab(playerBaseTarget); break; } //----------------------------------------------------------- if (GUI.changed) //apply changes made in editor ??I think.. TODO find out more about this { EditorUtility.SetDirty(target); } }