bhartu
1
hello,
I am working on space shooter like game.
I want to spawn enemies with frequent time delay.
My Question is should i start coroutine everytime, or place a while loop in one coroutine so that i do not have to
start coroutine everytime ??
which is better?
does it(while loop option) affect in performance issue or not??
I just put my function:
void Start()
{
StartCoroutine(FunctionName());
}
IENumerator FunctionName()
{
while(true)
{
yield return new WaitforSeconds(time you want);
instantiate enemy
yield return new WaitforSeconds(time you want);
}
}
I found this to work better then invoke repeating
Sounds like you need to Invoke something Repeatedly…ta-daa: InvokeRepeating