public void GenGameObjects() { for (int i = 0; i < 6; i++) { On_Shore_l [i] = i; On_Shore_r [i] = 6; } for (int i = 0; i < 2; i++) { On_Boat [i] = 6; } movetheboat = false; Shore_l = GameObject.CreatePrimitive(PrimitiveType.Cube); Shore_l.name = "Shore_l"; Shore_l.transform.position = new Vector3(-20f, 0, 0); Shore_l.transform.localScale = new Vector3(12f, 4.5f, 0); Shore_r = GameObject.CreatePrimitive(PrimitiveType.Cube); Shore_r.name = "Shore_r"; Shore_r.transform.position = new Vector3(20f, 0, 0); Shore_r.transform.localScale = new Vector3(12f, 4.5f, 0); Boat = GameObject.CreatePrimitive(PrimitiveType.Cube); Boat.name = "Boat"; Boat.transform.position = new Vector3(-10f, -2.25f, 0); Boat.transform.localScale = new Vector3(8f, 0.5f, 4); GameObject Priest; float Priest_position_x = -25f; for (int i = 0; i < 3; i++) { Priest = GameObject.CreatePrimitive(PrimitiveType.Sphere); Priest.transform.localScale = new Vector3(1, 1, 1); Priest.transform.position = new Vector3(Priest_position_x, 3f, 0); Priest_position_x += 2; Priest.AddComponent <On_Off> (); Priest.name = i.ToString(); dp [i] = Priest; } GameObject Devil; float Devil_position_x = -19f; for (int i = 3; i < 6; i++) { Devil = GameObject.CreatePrimitive(PrimitiveType.Cube); Devil.transform.localScale = new Vector3(1, 1, 1); Devil.transform.position = new Vector3(Devil_position_x, 3f, 0); Devil_position_x += 2; Devil.AddComponent <On_Off> (); Devil.name = i.ToString(); dp [i] = Devil; } }