A* Pathfinding Project

I would like to know if the following components work together well



I would like to know if the following components work together well.


You have modified the Update code in the LegacyAIPath.cs file to use rvoController.Move.

RVOController was added to prevent characters from overlapping each other.

The FixedUpdate code in the AIBase.cs file has been removed, and the Update code has been modified to use the MovementUpdate function and the FinalizeMovement function.

A CharacterController has been added to the character Component.

In this case, I want to know if there is a conflict or bug, and whether I am using it properly.



Yes, RVOController and AIPath have out of the box support for each other.
You can see an example in the RVO 2D example scene.

I recommend that you do not use a character controller together with RVO because it will prevent collisions using a completely, while the local avoidance system may require that they overlap slightly in very crowded scenarios or when passing each other. Using a character controller can decrease the avoidance quality a lot.


If you delete the CharacterController and add Rigdbody and CapsuleCollider to the Component, the NPC will appear on top of the other NPC.
It also slips out of the map when it collides with the player character.
Before using RVOController, I only added AIPath to Component, so I had to add CharacterController because it happened when I was testing it, so that the character could catch some physical bugs.
If you do not recommend using the RVOController and CharacterController together, I would like to know if there are other ways for NPCs to avoid each other.



I would recommend that you disable collisions between different agents altogether. The local avoidance system should take care of minimizing overlaps between them.

If you want to prevent the agents from moving outside the graph you can enable the ‘constrain inside graph’ checkbox on the AIPath script.


When I checked the CPU occupation status through Unity Profiler, I confirmed that AIBase.cs Update had a lot of use in .

MovementUpdate ()
FinalizeMovement ()

This functions occupy more than 50% of the CPU and Profiler 16ms(50fps).

Is there a solution for this?


Listen to your advice, I remove CharacterController.
We added Rigidbody and CapsuleCollider.

So when I spawned 80 npcs, 10ms and 90frames came out.

I expect to have over 90 frames when I spawn 200 npc.


Well. 90fps at 200 characters is not trivial to achieve with a script built to work for a very large variety of game types. That’s only 0.05 ms per character, and that’s assuming the whole frame can be used by the AI (which it really cannot).

I can achieve around 90fps with 200 characters in a test scene while using the RichAI movement script (however AIPath should be similar) and RVO. Those agents do not use any physics component at all (no CharacterController, no rigidbody, no capsule collider, they rely on the local avoidance for collision). I think you will win the most on removing the physics components if you can, those are usually pretty slow.

Make sure that you profile in a standalone build. The package is significantly faster in standalone builds compared to in the Unity Editor (with the same setup I only get around 30 fps in the Unity editor).
Also if you can I would recommend using a recent Unity version so that you can use the new mono backend which is significantly faster than the old one.