private GUIStyle guiStyle = new GUIStyle(); //create a new variable void OnGUI() { guiStyle.fontSize = 48; //change the font size GUI.Label(new Rect(10, 10, 100, 200), "Episode: " + episode, guiStyle); if (GUI.Button(new Rect(10, 100, 75, 30), "Save")) { Debug.Log("SAVED"); this.QtargetNetwork.write("QTargetNetwork"); this.Qnetwork.write("QNetwork"); } if (GUI.Button(new Rect(90, 100, 75, 30), "SaveGraph")) { Memory.saveGraphs(EpisodeController.returnValues, EpisodeController.returnCounts, "graph.txt"); Debug.Log("Graph SAVED"); } if (GUI.Button(new Rect(10, 140, 75, 30), "Load")) { Debug.Log("LOADED"); this.QtargetNetwork.read("QTargetNetwork"); this.Qnetwork.read("QNetwork"); EpisodeController.epsilon = 0.1f; EpisodeController.epsilon_min = 0.1f; EpisodeController.training = false; RandomInit = false; curriculum = false; } if (GUI.Button(new Rect(10, 180, 75, 30), "Obstacle")) { Debug.Log("OBSTACLE"); int index = rng.Next(0, numobstacles); obstacles[index] = (GameObject)Instantiate(Obstacle, OPositions[index], ORotations[index]); } if (GUI.Button(new Rect(90, 140, 70, 30), "Add Car")) { if (numinst < numcars) { int index = getIndex(numinst); Quaternion cur_rotation = getRotation(index); Vector3 cur_position = getPosition(index); cars[numinst] = (GameObject)Instantiate(CarFab, cur_position, cur_rotation); CarManager m = cars[numinst].GetComponent(typeof(CarManager)) as CarManager; if (!multipletrainers && numinst != 0) { m.training = false; m.display_qvalues = false; m.report = false; m.epsilon = m.epsilon_min; } else { m.display_qvalues = false; m.SetMLP(this.Qnetwork, this.QtargetNetwork); } cars[numinst].name = "CloneCar" + numinst; numinst++; } } if (GUI.Button(new Rect(90, 180, 70, 30), "Restart")) { Debug.Log("RESTART"); for (int i = 0; i < numinst; i++) { CarManager m = cars[i].GetComponent(typeof(CarManager)) as CarManager; m.Die(); if (!m.isEnabled()) { int index = getIndex(i); Quaternion cur_rotation = getRotation(index); Vector3 cur_position = getPosition(index); m.Restart(cur_position, cur_rotation); } } UserCarControl usercar = GameObject.Find("UserCar").GetComponent(typeof(UserCarControl)) as UserCarControl; usercar.Restart(); } if (GUI.Button(new Rect(170, 100, 70, 30), "Test Mode")) { Debug.Log("Test mode"); for (int i = 0; i < numinst; i++) { CarManager m = cars[i].GetComponent(typeof(CarManager)) as CarManager; m.training = !m.training; Debug.Log("Test mode: " + !m.training); } } GUI.Label(new Rect(10, 330, 200, 30), "Q-Values"); }