Creating nav meshes in prefabs for endless runner

I’m working on an idea and was wondering if it is possible to have a mesh created and associated with a prefab. I’m looking to create track sections for an endless runner type and adding the sections on at runtime.

Hey, take a look at https://arongranberg.com/astar/docs/save-load-graphs.php

You can easily load additional graphs during runtime

Thanks. I’ll give this a shot. I think I need to think through how I’m attempting this.

Since in an endless runner the graph that is used at any one point is likely quite small I think it would be feasible to recalculate the whole graph every time you add a new section. Might be a problem for low end mobile devices though.

That’s a really good point. The sections are going to be fairly simple, so recalculating would seem to be the way to go. I was trying to add sections on with prefaced graphs but couldn’t get that to behave properly.

I also see some people handle endless runners by keeping the player static and just moving the world elements. I’ll not likely use that approach but I’d be interested in hearing your thoughts on how one might handle a situation like that.

In my opinion it is simpler to keep the world static and move the player. That way you can use particle systems in world space and everything works more nicely.
If you have a very long game you might want to move the whole world once in a while to the origin to avoid running out of floating point precision though.

Thanks. It’s that floating point precision issue that I am hoping to avoid.

On a separate note, I have another project that I am using agents in that I was attempting to get some reasonable local avoidance working in for a large crowd of characters. I had been attempting it with Unity’s built in nav package and got it working fairly well but not reliably and with a LOT of layered sensors to keep things working. I decided to give your asset a try (I purchased it ages ago and used it once in a different project) and all of the local avoidance works pretty much out of the box. The difference is staggering, so thanks for that.

Ok.
Well there is https://arongranberg.com/astar/docs/gridgraph.html#RelocateNodes2 (there are similar overloads for all other graph types, check the docs for the graph you are interested in) which allows you to move all the nodes in the graph should you so wish.

Yay :blush:. Thank you for the kind words! I’m glad it worked out well for you.
If you want to support the package even more, a rating and/or review in the asset store with your experience is always a great help :slight_smile: