Beginner_
Beginner_

Reputation: 705

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.

Upvotes: 4

Views: 1656

Answers (1)

ARR
ARR

Reputation: 2308

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!

Upvotes: 2

Related Questions