public void PopulateFromSuitDefinition(DefinedSuit definition)
 {
     if (definition != null)
     {
         DefaultOptions  = definition.MySuit.DefaultOptions.ToList();
         SuitHolders     = definition.MySuit.SuitHolders.ToList();
         SceneReferences = definition.MySuit.SceneReferences.ToList();
         HapticsLayer    = definition.MySuit.HapticsLayer;
         //We can't change stuff, we imported it
         CanChangeValues             = false;
         AddChildObjects             = definition.MySuit.AddChildObjects;
         AddExclusiveTriggerCollider = definition.MySuit.AddExclusiveTriggerCollider;
     }
 }
            void DrawOptions(GUILayoutOption[] options)
            {
                GUIContent content = new GUIContent();
                float      width   = EditorGUIUtility.currentViewWidth;

                GUILayoutOption[] innerOptions = { GUILayout.MaxWidth(width / 2 - 10), GUILayout.MinWidth(35) };

                GUIStyle columnStyle = new GUIStyle(EditorStyles.toolbarButton);

                EditorGUILayout.BeginVertical("Box");
                #region Suit Auto-Configuration
                //EditorGUILayout.LabelField("Suit Options");
                SuitRootObjectField(options);

                content = new GUIContent("Autoconfigure based on Root Object", "Uses common names to try and establish the different suit body colliders for the suit.");
                bool Result = OperationButton(SuitRoot == null, content);
                if (Result)
                {
                    DefinedSuit definition = SuitRoot.GetComponent <DefinedSuit>();

                    if (definition != null)
                    {
                        PopulateFromSuitDefinition(definition);
                    }
                    else
                    {
                        //	//Check if they have anything assigned.
                        //	//If they do, warn them this will overwrite it.
                        AutoFindElementsFromRoot(SuitRoot);
                    }
                }
                #endregion

                //content = new GUIContent("Can Change Values", "Can't be adjusted if you have a current layout. Remove SuitBodyColliders to adjust config.");
                //CanChangeValues = CreateStyledToggle(false, CanChangeValues, content, innerOptions);

                EditorGUILayout.BeginHorizontal();
                content         = new GUIContent("Add Child Objects", "Create child objects instead of directly adding to the targeted object.");
                AddChildObjects = CreateStyledToggle(!CanChangeValues, AddChildObjects, content, innerOptions);

                content = new GUIContent("Add New Colliders", "Adds SuitBodyCollider objects instead of using existing ones or letting you configure it manually.\nWill add the colliders to child objects if that is also selected.");
                AddExclusiveTriggerCollider = CreateStyledToggle(!CanChangeValues, AddExclusiveTriggerCollider, content, innerOptions);

                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();
            }
            string AddComponentForSuit()
            {
                string output = string.Empty;

                DefinedSuit suitDef = null;

                if (SuitRoot != null)
                {
                    suitDef = SuitRoot.GetComponent <DefinedSuit>();
                    if (suitDef == null)
                    {
                        SuitRoot.AddComponent <DefinedSuit>();
                    }
                }

                if (suitDef != null)
                {
                    suitDef.MySuit.AddChildObjects             = AddChildObjects;
                    suitDef.MySuit.AddExclusiveTriggerCollider = AddExclusiveTriggerCollider;
                    suitDef.MySuit.SuitHolders    = SuitHolders.ToList();
                    suitDef.MySuit.DefaultOptions = DefaultOptions.ToList();
                    suitDef.MySuit.SuitRoot       = SuitRoot;
                }

                for (int i = 0; i < SuitHolders.Count; i++)
                {
                    if (SuitHolders[i] != null)
                    {
                        Undo.RecordObject(SuitHolders[i], "Add Suit Node to Marked Objects");

                        output += "Processing " + SuitHolders[i].name + "";
                        GameObject targetGO = AddChildObjects ? SuitHolders[i].transform.FindChild(SuitHolders[i].name + childAppendName).gameObject : SuitHolders[i];

                        Collider col = null;
                        //Check if it has one already
                        SuitBodyCollider suit = targetGO.GetComponent <SuitBodyCollider>();
                        if (suit == null)
                        {
                            //Add one if it doesn't
                            //suit = targetGO.AddComponent<SuitBodyCollider>(); - Not undo-able

                            suit = Undo.AddComponent <SuitBodyCollider>(targetGO);

                            if (AddExclusiveTriggerCollider)
                            {
                                col = AddColliderForSuit(suit);
                            }

                            if (suitDef != null)
                            {
                                suitDef.MySuit.SceneReferences[i] = suit;
                            }

                            output += "\t  Adding Suit Body Collider to " + SuitHolders[i].name + "";
                        }

                        output += "\t  Adding " + DefaultOptions[i].ToString() + " " + SuitHolders[i].name + "\n";

                        //Add this region to it.
                        suit.regionID = suit.regionID | DefaultOptions[i];

                        //Save the collider if we made one
                        if (col != null)
                        {
                            suit.myCollider = col;
                        }

                        SceneReferences[i] = suit;

                        //Don't let the user change anything until they've deleted these?
                        //These functions aren't robust enough yet.
                        CanChangeValues = false;
                    }
                }

                output = "Creating SuitBodyCollider - Operation Finished\n\n" + output + "\n";
                return(output);
            }