- Home /
Can be a problem having about 300-500 Nav mesh agents with corutines simultaneously
Hello there!
I'm thinking ways to get what i need, and one possiblity is to have more than 500 gameobjects with its own scripts, where will be always a corutine, something like this:
while (true)
{
/// some navmesh agent things
yield return new WaitforSeconds (Random.Range(30,300));
}
Can be this a problem for performance? And if instead of 500 objects, are more than 750 ? 1000? anybody did something similar? Any advice?
Thanks in advance!
Answer by revolute · Oct 02, 2019 at 06:13 AM
500, 750, 1000 it all depends on the situation. On a pc with sufficient power, no prob. On a mobile device, it will consume a bit of computing power.
I don't think the coroutines will cause hiccup. 500 nav mesh will slow down significantly that 500 coroutines wont be the problem.
Usually, the pattern I'd go is singleton manager class that manages all timer objects and run certain function everynow and then. Having 500 monobehaviours and each running a timer isn't exactly the fastest.
Honestly, the amount of information provided in the question isn't really much to go on. Do you want to run 500 nav mesh agents with 500 coroutines turning them on and off or are the coroutines somewhat irrelevant to your case?
Your answer
Follow this Question
Related Questions
Choking on WaitForSeconds coroutine (solved) 3 Answers
Problem with AI script: is there any way to add delay to a function called from Update method? 1 Answer
Coroutine doesnt turn bool? 0 Answers
Update SetDestination only every 0.2s with coroutines ? 5 Answers
Navmesh and clickable object 1 Answer