Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BuildNavMesh is too slow

    NavMeshSurface.BuildNavMesh();

I want to do "Bake" of NavMesh dynamically. My game is like Minecraft. I move the MOB around the world. Player can place blocks. So, if I do BuildNavMesh() I will be able to "Bake" NavMesh with new blocks.

Blocks is placed by the player. And every time player puts a block, I do BuildNavMesh(). Players can jump on them. Player can also destroy those blocks.

As I mentioned earlier, I do not know what to do other than that. I can only write the above code.

    NavMeshSurface.BuildNavMesh();

The best result I want is to use NavMesh to dynamically change the MOB's range of motion.

like image 515
Beginner_ Avatar asked Oct 19 '25 03:10

Beginner_


1 Answers

My navmesh was also building extremely slow. 2 things that really helped were:

  1. play around with the tile size on the NavMeshSurface component, the smaller the faster it will build but it has some tradeoffs.
  2. remove unnecessary layers from you NavMeshSurface component. And this was really the biggest issue. I had the default layer and ui layers in there which caused a big lag, removing them almost instantly rebuilds the navmesh in runtime!
like image 70
ARR Avatar answered Oct 21 '25 16:10

ARR



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!