Hi everyone
I’m having an issue with Instantiate().
I have an GameObject which is made to duplicate an other gameobject each 5 seconds :
void Update()
{
time += Time.deltaTime;
if(time >= 5)
{
time = 0;
nb_star += 1;
choosen = rand.Next(0, nb_routes);
starList.Add(Instantiate(starpack));
starList[nb_star].transform.Find("star red").GetComponentInChildren<PathFollower>().pathCreator = route_list[choosen].transform.Find("route").GetComponentInChildren<PathCreator>();
}
}
But when the command “starList.Add(Instantiate(starpack));” executes it breaks the Update() and goes on Update() of the other scripts.
Do you know why and how I could fix it?
Many thanks, tell me if you need the rest of the code