- Home /
Question by
Paplexa · Dec 22, 2015 at 08:58 AM ·
scripting problemgameobjectprefabsprefab-instance
Unity 2D Game Issue: Script is only affecting one prefab instead of all of them.
I have a problem in a game that I'm making. I have a script attached to a prefab that is supposed to make every instance of the prefab spawn at the top of the screen once it hits the bottom of the floor.
#pragma strict
function Start () {
};
function Update () {
};
function SpawnLoop()
{
gameObject.SetActive (false);
yield WaitForSeconds (Random.Range(0.0,5.0));
gameObject.SetActive (true);
transform.position = Vector2(transform.position.x,6);
};
Why is this only affecting one instance of the prefab instead of all of them?
Comment