public override void OnInspectorGUI() { base.OnInspectorGUI(); obj = (MultiPartsObject)target; if (GUILayout.Button("Setup")) { obj.Setup(); } if (GUILayout.Button("Fit")) { obj.FitToScale(obj.Root, obj.VirtualScale); } if (GUILayout.Button("Reset")) { obj.ResetTransform(obj.Root); } GUILayout.Space(10); GUILayout.Label("Tree"); GUILayout.BeginVertical(); DisplayNodeInfo(obj.Root); GUILayout.EndVertical(); }
public override void OnInspectorGUI() { // draw default inspector gui base.OnInspectorGUI(); // get the target obj = (MultiPartsObject)target; // to setup internal data structure after inserting the gameobject if (GUILayout.Button("Setup")) { obj.Setup(); } // to fit the object into the cage size if (GUILayout.Button("Fit")) { obj.FitToScale(obj.Root, obj.VirtualScale); } // to find missing game objects if (GUILayout.Button("Find Missing Objects by Name")) { obj.FindMissingObjectsByName(obj.Root); } // to find missing game objects if (GUILayout.Button("Capture GameObject Names")) { obj.CaptureGameObjectName(obj.Root); } // to reset all transform position, rotation, and scale if (GUILayout.Button("Reset")) { obj.ResetAll(obj.Root); obj.transform.localScale = Vector3.one; } GUILayout.Space(10); // to unlock / lock all nodes with one click if (GUILayout.Button(lockState?"Unlock All Nodes":"Lock All Nodes")) { lockState = !lockState; obj.SetNodeLockRecursive(obj.Root, lockState); } // draw the tree structure GUILayout.Label("Tree"); indentLevel = 0; DisplayNodeInfo(obj.Root); // if something is changed in the editor, make scene dirty if (GUI.changed) { EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene()); } }