Hi, I need help figuring out what I’m doing wrong that’s causing a lot of time to be spent on these calls related to “JobRepairEnd”. See images
.
I have a 2D grid graph that’s 120 x 95 nodes and node size 0.3. It’s actually a wide open space with no obstacles yet, so collision is disabled. I also have an RVOSimulator (see
I also have agents that use FollowerEntity and AIDestinationSetter (see image
Some things that seem suspicious are:
To stop an agent from moving, I set FollowerEntity.isStopped to true and set the path to null like so:
public override void ToggleMovement(bool is_toggle_on) {
if (!_path_ai) {
return;
}
_path_ai.isStopped = !is_toggle_on;
if (_path_ai && _path_ai.hasPath && !is_toggle_on) {
_path_ai.SetPath(null);
}
}
Should I not be clearing the path like this?
Another potential issue is that this is a horde game and when the player is surrounded, only a handful of agents can reach the player, but the hundreds of other agents still try. Should I be handling this somehow?
Lastly, this is a 2D top-down game where I don’t want any rotation (because I instead use different sprite animations for directions), so I turn off rotation when an agent spawns in. Could this be causing issues with path calculations?
private void OnEnable() {
_ai.updateRotation = false;
gameObject.transform.rotation = Quaternion.Euler(0, 0, 0);
}
Thank you in advance for any guidance!