Still problem with static var, why?

//Simple Instantiation of a Prefab at Start

var thePrefab : GameObject;

 

function Start () {

 yield WaitForSeconds(2);

 var instance : GameObject = Instantiate(thePrefab, transform.position, transform.rotation);

 

}

i want to create the thing every 2 secounds, but how? i know that i cant put it in update function

:slight_smile:

  1. Dont bump more than once every 24 hours.

2a. Look into InvokeRepeating
or
2b. put it inside while (true) {}

Okay :wink: Ty didn’t know about the 24 hours rule :wink: Now i know

Just create a coroutine

void Start()
{
    StartCoroutine(Create());
}

IEnumerator Create()
{
    while (true)
    {
        yield return new WaitForSeconds(2);
        Instantiate(thePrefab, transform.position, transform.rotation);
    }
}

It’s c#, I can’t remember javascript syntax off the top of my head

Thanks Problemed solved :wink:

Thread Closed :wink: