void Start() { rb = this.GetComponent <Rigidbody2D>(); spawnsc = GameObject.Find("Spawner").GetComponent <SpawningScript>(); //This finds the text for the score. score = GameObject.Find("scoretext").GetComponent <ScoreScript>(); if (GameObject.Find("player") != null) { weapon = GameObject.Find("player").GetComponent <Weapons_Systems>(); } }
void Start() { rb = this.GetComponent <Rigidbody2D>(); if (GameObject.FindWithTag("Player") != null) { player = GameObject.FindWithTag("Player").transform; } timeBtwShots = startTimeBtwShots; spawnsc = GameObject.Find("Spawner").GetComponent <SpawningScript>(); score = GameObject.Find("scoretext").GetComponent <ScoreScript>(); weapon = GameObject.Find("player").GetComponent <Weapons_Systems>(); }