private void OnGUI()
        {
            float cHeight = 85f + fieldHeight * 3f;

            EditorGUILayout.LabelField("Substance Inspector", EditorStyles.boldLabel, GUILayout.Height(fieldHeight));
            EditorGUILayout.Space(5f);
            if (boxState == SubstanceBoxState.New)
            {
                DrawSubstanceEditor();
                if (GUILayout.Button("Add Substance", GUILayout.Height(fieldHeight)))
                {
                    SubstanceTable.Add(modifiedSubstance);
                    boxState = SubstanceBoxState.None;
                }
                if (GUILayout.Button("Discard", GUILayout.Height(fieldHeight)))
                {
                    boxState          = SubstanceBoxState.None;
                    modifiedSubstance = new Substance();
                }
                cHeight += 4f * fieldHeight;
            }
            else if (boxState == SubstanceBoxState.Inspect)
            {
                DrawSubstanceEditor();
                if (GUILayout.Button("Save", GUILayout.Height(fieldHeight)))
                {
                    SubstanceTable.substances[inspectedSubstance] = modifiedSubstance;
                    boxState = SubstanceBoxState.None;
                }
                if (GUILayout.Button("Remove", GUILayout.Height(fieldHeight)))
                {
                    SubstanceTable.Remove(modifiedSubstance);
                    boxState = SubstanceBoxState.None;
                }
                if (GUILayout.Button("Discard", GUILayout.Height(fieldHeight)))
                {
                    modifiedSubstance = new Substance();
                    boxState          = SubstanceBoxState.None;
                }
                cHeight += 5f * fieldHeight;
            }
            else
            {
                if (GUILayout.Button("Create Substance", GUILayout.Height(fieldHeight)))
                {
                    boxState          = SubstanceBoxState.New;
                    modifiedSubstance = new Substance();
                }
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Inspect Substance Of Index", GUILayout.Height(fieldHeight)))
                {
                    if (inspectedSubstance > 0 && inspectedSubstance < SubstanceTable.substances.Count)
                    {
                        boxState          = SubstanceBoxState.Inspect;
                        modifiedSubstance = new Substance(SubstanceTable.substances[inspectedSubstance]);
                    }
                    else
                    {
                        Debug.LogWarning("Inspected Substance Index must be greater than zero and less than substances count");
                    }
                }
                inspectedSubstance = EditorGUILayout.IntField(inspectedSubstance, GUILayout.Height(fieldHeight));
                GUILayout.EndHorizontal();
                if (inspectedSubstance > 0 && inspectedSubstance < SubstanceTable.substances.Count)
                {
                    EditorGUILayout.LabelField(SubstanceTable.substances[inspectedSubstance].name, GUILayout.Height(fieldHeight));
                }
                else
                {
                    EditorGUILayout.LabelField("", GUILayout.Height(fieldHeight));
                }
                cHeight += 3f * fieldHeight;
            }
            EditorGUILayout.LabelField("Substance List", EditorStyles.boldLabel, GUILayout.Height(fieldHeight));
            if (showSubstances)
            {
                if (GUILayout.Button("Hide substance list", GUILayout.Height(fieldHeight)))
                {
                    showSubstances = false;
                }
                scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(position.width), GUILayout.Height(position.height - cHeight));
                for (int i = 0; i < SubstanceTable.substances.Count; i++)
                {
                    DrawSubstance(i);
                }
                EditorGUILayout.EndScrollView();
            }
            else
            {
                if (GUILayout.Button("Show substance list", GUILayout.Height(fieldHeight)))
                {
                    showSubstances = true;
                }
            }

            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Update", GUILayout.Height(25f)))
            {
                SubstanceTable.Init();
            }
            if (GUILayout.Button("Save To File", GUILayout.Height(25f)))
            {
                SubstanceTable.Save();
            }
        }
 public static void Remove(Substance s)
 {
     substances.Remove(s);
 }