void Spawn(int i, ref Vector3 _pos, ref Vector3 _rota) { obstacles[i] = obstacleSpawner.ObstacleSpawn(out _pos, out _rota); Debug.Log("Obstacle spawned"); obstacleScripts[i] = obstacles[i].gameObject.GetComponent <Obstacle>(); if (obstacleScripts[i] == null) { Debug.Log("Obstacle null"); } obstacleScripts[i].Init(); }