Get low fps when using RVO (1 FPS / 1000ms) in my rgp/RTS hybrid game

Tested disabled Multithreading for both the RVO and the A* Pathfinding script.

Unity version: 2020.3.36f1 LTS

My setup:
One GameObject with: Pathfinder - Recast graph
One GameObject with: RVO Simulator + RVO Navmesh (Desired Simulation FPS: 5)

– Scene consists of –
“2D Grid” (but placed in 3D, e.g. Y is up, not using unitys “2D style”), roughly 350x350 tiles using tilemaps. but physics / Pathfinding don’t bother with these tiles, instead they see:

One large flat quad mesh as ground
Multiple Obstacles like ocean + mountains have colliders, but made an obstacle-creator that “fills” the map with larger obstacles, so instead of 350 x 350 = 122500 colliders which are 1x1x1 cube-sized colliders, it goes down to 1050 colliders.

Agents are a bit more complicated:
They have:
Capsule collider

Rich AI
RVO Controller

  • child GameObject with Rigidbody + SphereCollider (used for threat-detection of units)
  • if ranged units, another child with Rb + sphereColl, used for attack-range.
    // Reason for having a rigidbody on childs, is because Unity group up all colliders “upwards”. So if a GameObject have multiple colliders in itself + in children. They will all start an event with scripts listening on root GameObject collider. And as I want an “AttackRange-detector-class” handle attack-range by itself. thus, needed a rigid-body on it.

So if I’m disabling using multiple threads on the pathfinder + RVO, i get a performance issue here:
…,Agent.CalculateVelocity() // This one cost 780ms for 60 agents
…,…Vector2.get_normalized() // called 535804 times?
…,…Agent.To2D() // called 1071608 times?

And if i use multi-threading (high-load):
…,…,…,…,Monitor.Monitor_wait() // This one have Time ms and Self ms: 3666

And I’ve followed all documentation i could find + your example-scenes as well. Tried with none, Auto Low-load & high-load threads.

Used Unitys own Navmesh + agents system before and had not close to this bad fps? And this is just the beginning of the game, have roughly 500 agents? later on a map.
Reason for changing, had some performance issue later + unity pathfinding was stupid & tried to take shortcut over impassable terrain. And read so much good reviews on this, so thought it would solve the issue.


If you are profiling performance, make sure you do not use deep profiling.

The beta version also has much better local avoidance performance.

Oh? Alright, I’ll try without deep-profile. And thanks for the super-fast answer! :smiley:
Oh does it!? Is it “stable” compared to the default version? as my game is already released. So didn’t I dare to try the beta-version.

It’s pretty robust overall. Though newly released beta versions sometimes contain breaking bugs that typically get fixed very quickly.

Ahh ok. Maybe give it a try then.

Oh btw. I will need to do deep-profile in the future to test rest of my game. Can I in that case “disable” your part of the code not to be “profiled”? As it by itself, drop my fps down to 1 :frowning:
Or maybe that is something Unity allows me to do. gonna google it.

While i have you here. I have one other issue with the project.

The RTS-part of the game, allows me to place structures live. And as I’m using the Recast Graph, So did i try Navmeshcut. But when they want to attack such structure, i assume they all take the closest position to its center (as they can’t walk on a cutted-navmesh). And that can make them walk “around” the structure, as that point is at the back.

So then i saw RVO uses another obstacle-avoidance system, e.g. the SquareObstacle you made. So when i add that to the structure instead of a navmeshcut. They can attack it much better (go straight towards it). But when i have unit-spawning structures like an Barrack. And have the spawn-point at the other side of the structure, towards their “path/goal”. They get stuck in the structure :frowning: .

So either they attack weird, or they most of the part, can’t move after spawned next to the structure :frowning:.

Any first idea for solution for it?

That + my previous issue should solve the biggest issues I’m having with the pathfinder :smiley:

This is not possible that I know of.

I’d recommend either biasing the target point slightly towards the agent’s position (e.g. 0.5 meters towards the agent from the building’s center), or to place some attack points and use a MultiTargetPath.

Ohh bollocks… Hmmmm. Any ideas on how i can deep-profile my game then, using your project? As Deep-profile is something I really need to be able to do?

Yeah thought that as well using NavmeshCut. Regarding the “Attack-points” and a “Multi-Target-Paths” are both of those components / code you have in the package :slight_smile:?

Tried to find how to install the new version, and found the site:
A* Pathfinding Project (
but it said:
Installing using the package manager requires Unity 2022.2.10f1 or higher.
And as I’m only using 2020.3 version. Is there another way for me? Or have to update my version first?

Sorry. The minimum is 2022.2.10f1.

See MultiTargetPath - A* Pathfinding Project

1 Like

For others reading this, it seems to be possible to stop profiling classes/methods using a specific tag:
Unity - Scripting API: IgnoredByDeepProfilerAttribute (

Only seems to work in 2022.2 ->.

1 Like

After updating unity to 2022 to support the IgnoredByDeepProfileAttribute, it seems it doesn’t “cut off” the profiler, So in my case, even if I added this on a specific class/method I didn’t want deep-profiled. If it called methods in other classes, those would still be logged. Which is to bad, when I can’t modify code from packages.