public override void OnInspectorGUI()
 {
     serializedObject.Update();
     //disableMargin = true;
     //UseDefaultMargins();
     flowchart.graph = (VCSUGraph)EditorGUILayout.ObjectField("Graph", flowchart.graph, typeof(VCSUGraph), true);
     if (flowchart.graph)
     {
         if (AssetDatabase.Contains(flowchart.graph))
         {
             flowchart.graph = VCSUObject.Clone(flowchart.graph);
         }
     }
     if (!EditorApplication.isPlaying)
     {
         if (GUILayout.Button("Generate Test Script"))
         {
             var dc = new DynamicClass();
             dc.Import(flowchart.graph);
             dc.Export();
         }
     }
     GUILayout.BeginHorizontal(EditorStyles.inspectorDefaultMargins);
     if (GUILayout.Button("Open Graph"))
     {
         FlowchartEditorWindow.Init(flowchart.graph);
     }
     if (GUILayout.Button("Revert To Original"))
     {
         var oGraph = (VCSUGraph)EditorUtility.InstanceIDToObject(flowchart.graph.OriginalIID);
         if (!oGraph)
         {
             oGraph = AssetDatabase.LoadAssetAtPath <VCSUGraph>(flowchart.graph.OriginalPath);
         }
         if (oGraph)
         {
             flowchart.graph = VCSUObject.Clone(oGraph);
         }
     }
     if (GUILayout.Button("Apply To Original Graph"))
     {
         var oGraph = (VCSUGraph)EditorUtility.InstanceIDToObject(flowchart.graph.OriginalIID);
         if (!oGraph)
         {
             oGraph = AssetDatabase.LoadAssetAtPath <VCSUGraph>(flowchart.graph.OriginalPath);
         }
         if (oGraph)
         {
             VCSUObject.ApplyFromClone(flowchart.graph, oGraph);
         }
     }
     GUILayout.EndHorizontal();
     if (variables != null)
     {
         XmlDictionary <string, VariableTest> renameds = new XmlDictionary <string, VariableTest>();
         foreach (var variable in variables)
         {
             var frect    = EditorGUILayout.BeginVertical(EditorStyles.inspectorFullWidthMargins);
             var fboxRect = new Rect(frect.x, frect.y - 1.5f, frect.width + 1, frect.height + 2.5f);
             GUI.Box(fboxRect, "");
             GUI.Button(new Rect(frect.x + 5, frect.center.y - 7.5f, 20, 20), '\u003D'.ToString(), GUIStyle.none);
             var name = variable.Value.name;
             GUILayout.BeginHorizontal();
             GUILayout.Space(15);
             variable.Value.name = EditorGUILayout.TextField(variable.Value.name);
             GUILayout.EndHorizontal();
             var variableType = variable.Value.variableType;
             GUILayout.BeginHorizontal();
             GUILayout.Space(15);
             variable.Value.variableType = (VariableType)EditorGUILayout.EnumPopup(variable.Value.variableType);
             GUILayout.EndHorizontal();
             if (variableType != variable.Value.variableType)
             {
                 GUIChanged = true;
             }
             Tuple <bool, object> value = null;
             GUILayout.BeginHorizontal();
             GUILayout.Space(15);
             if (variable.Value.variableType != VariableType.Object)
             {
                 value = GUIExtended.DrawGUISwitch(variable.Value.variableType.ToString(), variable.Value.value);
             }
             else
             {
                 value = GUIExtended.DrawGUIUObject(variable.Value.value);
             }
             GUILayout.EndHorizontal();
             if (value != null)
             {
                 if (value.Item1 == true)
                 {
                     GUIChanged = true;
                 }
                 variable.Value.value = value.Item2;
             }
             if (name != variable.Value.name)
             {
                 renameds.Add(variable.Key, variable.Value);
             }
             EditorGUILayout.EndVertical();
         }
         foreach (var renamed in renameds)
         {
             var index = variables.Values.IndexOf(renamed.Value);
             variables.RemoveAt(index);
             if (variables.Count < index)
             {
                 variables.Add(renamed.Key, renamed.Value);
             }
             else
             {
                 variables.Insert(index, new XmlKeyValuePair <string, VariableTest>(renamed.Key, renamed.Value));
             }
         }
         var trect    = EditorGUILayout.BeginHorizontal(EditorStyles.inspectorFullWidthMargins);
         var rect     = GUILayoutUtility.GetRect(trect.width, trect.height + 16);
         var tboxRect = new Rect(trect.x, rect.y, trect.width - 30, rect.height);
         TempVariable = EditorGUI.TextField(tboxRect, TempVariable);
         if (GUI.Button(new Rect(trect.width - 30, rect.y, 30, rect.height), '\u002B'.ToString()) && !string.IsNullOrEmpty(TempVariable))
         {
             var variable = new VariableTest();
             variable.name = TempVariable;
             variables.Add(TempVariable, variable);
             TempVariable = string.Empty;
             GUIChanged   = true;
         }
         if (string.IsNullOrEmpty(TempVariable))
         {
             EditorGUI.LabelField(tboxRect, "(New Variable Name)", TempLable());
         }
         EditorGUILayout.EndHorizontal();
         GUILayout.BeginHorizontal();
         if (GUILayout.Button("REMOVE"))
         {
             if (variables.Count > 0)
             {
                 variables.RemoveAt(variables.IndexOf(variables.Last()));
                 GUIChanged = true;
             }
         }
         GUILayout.EndHorizontal();
     }
     if (variables != null && variables.Count > 0)
     {
         SerializeData();
     }
     serializedObject.ApplyModifiedProperties();
 }