// Start is called before the first frame update void Start() { Spawnner spawnnerScript = GameObject.FindGameObjectWithTag("Spawnner") .GetComponent <Spawnner>(); // note - Spawnner here is name of the script // used to select random value in the range (maxSpeed not inc) speed = Random.Range(minSpeed, maxSpeed) + spawnnerScript.getAddedSpeed(); playerScript = GameObject.FindGameObjectWithTag("Player") .GetComponent <Player>(); // note - Player here is name of the script }
void setlane() { Spawnner[] spawnner = GameObject.FindObjectsOfType <Spawnner>(); foreach (Spawnner lane in spawnner) { if (lane.transform.position.y == this.transform.position.y) { mylane = lane; return; } } }
private void Awake() { Spawnner_Script = GameObject.FindObjectOfType <Spawnner>(); }