public SpawnGraph(MyEditorPanel graphP, int totalTime)
        {
            totalTimeToCount = totalTime;

            graphPanel = graphP;

            maxUnits = (int)SpawnTypes.GetMaximunNumberOfUnits(totalTimeToCount);
            totalUnitsAndUnitsPerSecForAllTypes = SpawnTypes.GetUnitsPerSec(totalTimeToCount);
            // Set up color array with random colors
            if (unitTypesColors == null)
            {
                SavedUnitTypeColorsArray savedCollorArrayObject = JsonLib.LoadGameData();
                if (savedCollorArrayObject != null && savedCollorArrayObject.colorArray.Length > 0)
                {
                    //Debug.Log("Unit types graph colors loaded from previous session");
                    unitTypesColors = savedCollorArrayObject.colorArray;
                }
                else
                {
                    //Debug.Log("No unit types graph colors loaded from previous session");
                    unitTypesColors = new Color[150];
                    for (int i = 0; i != unitTypesColors.Length; i++)
                    {
                        unitTypesColors[i]   = new Color(Random.Range(0, 0.9f), Random.Range(0, 0.9f), Random.Range(0, 0.9f), Random.Range(0, 0.9f));
                        unitTypesColors[i].a = 1;
                    }
                }
                JsonLib.SaveGameData(new SavedUnitTypeColorsArray(unitTypesColors));
            }
        }
 private void DrawUnitTypeList(Rect graphPanel)
 {
     for (int line = 0; line != SpawnTypes.GetAllTypes().Count; line++)
     {
         Rect rect = new Rect(graphPanel);
         rect.position = rect.position + new Vector2(-wavePanelXOffsetFromUnitTypes, line * collumAndLineSize);
         rect.width    = unitTypesListWidth;
         rect.height   = unitTypesListHeight;
         EditorGUI.LabelField(rect, SpawnTypes.GetAllTypes()[line]);
         rect.x     += unitTypesListWidth;
         rect.width  = 50;
         rect.height = 10;
         EditorGUI.BeginChangeCheck();
         unitTypesColors[line] = EditorGUI.ColorField(rect, unitTypesColors[line]);
         if (EditorGUI.EndChangeCheck())
         {
             Debug.Log("Color of unit type: " + SpawnTypes.GetAllTypes()[line] + " changed to " + unitTypesColors[line].ToString());
             JsonLib.SaveGameData(new SavedUnitTypeColorsArray(unitTypesColors));
         }
     }
 }