Variable not assigned but is.
using UnityEngine; using System.Collections;
public class MasterScript : MonoBehaviour { public GameObject zSOne; public GameObject zSTwo; public GameObject Zombie; public GameObject player; private int ZomsSpawned = 0; private int chosenSpawn; private int numberZombsPR = 1; private int numberZombsLeft = 1; private int currentRound = 1; private int points = 0; public GameObject[] spawners;
 // Use this for initialization
 void Start () {
     setSpawns ();
     currentRound = 1;
     numberZombsLeft = numberZombsPR;
 }
 public void setSpawns(){
     spawners = new GameObject[] {zSOne, zSTwo};
 }
 public void spawnZomb() {
     chosenSpawn = Random.Range (0, spawners.Length - 1);
     Vector3 spawner = new Vector3 (spawners[chosenSpawn].transform.position.x, spawners[chosenSpawn].transform.position.y, spawners[chosenSpawn].transform.position.z);
     Instantiate (Zombie, spawner, Quaternion.identity);
     ZomsSpawned += 1;
 }
 public int getCurrentRound () {
     return currentRound;
 }
 public void addPoints(int pointsGained) {
     points += pointsGained;
 }
 public int getZTR() {
     return numberZombsLeft;
 }
 public int calculateZombiesPR () {
     numberZombsPR = currentRound;
     return numberZombsPR;
 }
 public void changeRound() {
     currentRound += 1;
     calculateZombiesPR ();
     numberZombsLeft = numberZombsPR;
     ZomsSpawned = 0;
 }
 public int killZom() {
     return numberZombsLeft -= 1;
 }
 // Update is called once per frame
 void Update () {
     if (ZomsSpawned < numberZombsPR) {
         
         spawnZomb ();
     }
     if (numberZombsLeft == 0) {
         changeRound ();
     }
 }
 void OnGUI() {
     GUI.Box (new Rect(20, 20, 100, 20 ), currentRound.ToString());
     GUI.Box (new Rect(Screen.width - 100, Screen.height - 20, 100, 20 ), points.ToString());
     GUI.Box (new Rect(0, Screen.height - 20, 100, 20 ), numberZombsPR.ToString());
 }
}
plz check your code formating, you can post code correctly formated if you use the [101] icon above the textbox
and maybe you should add a sentence or two, your sourcecode will not be enough to provide an answer
I fixed it. Ins$$anonymous$$d of using a public variable for the game object, i used privates and found them in the scene.
Your answer
 
 
             Follow this Question
Related Questions
Can I assign no value to a variable like Gamemaker? 1 Answer
How to assign slider to float: Spin, on a gameobject 1 Answer
Instantiate a prefab and assign it's values 1 Answer
Trouble assigning Gameobject to variable in separate object 0 Answers
How to assign a variable(camera) to a prefab at start? (not an object) 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                