private void resetFields()
 {
     // Current attributes and container
     attribIsCore      = false;
     attribId          = "Enter your attribute id here";
     attribName        = "Enter your attribute name here";
     attribDescription = "Enter your attribute description here";
     attribMinValue    = 1;
     attribMaxValue    = 100;
     temporal          = new AttributeTRPG(attribIsCore, attribId, attribName, attribDescription, attribMinValue, attribMaxValue);
     // Attributes from database
     loadAttribsFromDatabase();
     attribCount    = attribsInDatabaseList.Count;
     selectedAttrib = 0;
 }
 void OnGUI()
 {
     // Events
     // Left mouse click on ADD/DELETE button
     if (Event.current.isMouse && Event.current.type == EventType.mouseDown && Event.current.button == 0)
     {
         loadAttribsFromDatabase();
     }
     // Zones
     // Selection zone
     EditorGUILayout.BeginVertical("Box");
     attribsInDatabaseArray = attribsInDatabaseList.ToArray();
     EditorGUI.BeginChangeCheck();
     selectedAttrib = EditorGUILayout.Popup(selectedAttrib, attribsInDatabaseArray, GUILayout.Width(60));
     if (EditorGUI.EndChangeCheck())
     {
         if (selectedAttrib == 0)  // if 'selectedAttrib' is '<NEW>' then reset the fields
         {
             resetFields();
         }
         else  // else if 'selectedAttrib' exists then manage it directly from database through 'temporal' container
         {
             temporal = Database.Instance.Attributes[attribsInDatabaseArray[selectedAttrib]];
         }
     }
     EditorGUILayout.EndVertical();
     // Edit (add, modify and delete) zone
     EditorGUILayout.BeginVertical("Box");
     if (selectedAttrib == 0)  // if 'selectedAttrib' is '<NEW>' then allow to create a id
     {
         temporal.id = EditorGUILayout.TextField("Attribute id", temporal.id);
     }
     else  // else if 'selectedAttrib' exists then do not allow to create a existing id
     {
         EditorGUILayout.LabelField("Attribute id                      " + temporal.id);
     }
     temporal.name        = EditorGUILayout.TextField("Attribute name", temporal.name);
     temporal.description = EditorGUILayout.TextField("Attribute description", temporal.description, GUILayout.Height(50));
     temporal.isCore      = EditorGUILayout.Toggle("Is basic/core attribute?", temporal.isCore);
     temporal.minValue    = EditorGUILayout.IntField("Min value", temporal.minValue);
     temporal.maxValue    = EditorGUILayout.IntField("Max value", temporal.maxValue);
     EditorGUILayout.EndVertical();
     EditorGUILayout.BeginVertical("Box");
     if (selectedAttrib == 0)  // if 'selectedAttrib' is '<NEW>' then the button adds
     {
         if (GUILayout.Button("ADD", GUILayout.Width(80), GUILayout.Height(80)))
         {
             if (Database.Instance.addAttribute(temporal))
             {
                 resetFields();
                 Debug.Log(">> Attribute added to database!");
             }
             else
             {
                 Debug.Log("X Error adding attribute to database!");
             }
         }
     }
     else
     {
         if (GUILayout.Button("DELETE", GUILayout.Width(80), GUILayout.Height(80)))
         {
             if (Database.Instance.deleteAttribute(attribsInDatabaseArray[selectedAttrib]))
             {
                 resetFields();
                 Debug.Log("<< Attribute deleted from database!");
             }
             else
             {
                 Debug.Log("X Error deleting attribute from database!");
             }
         }
     }
     EditorGUILayout.EndVertical();
 }