How is dtRecastNavMesh data passed from Editor to Game?

Hello everyone,

the detour nav mesh data is -usually- generated in the Editor. It contains information about level geometry, NavLinks etc. When the game is launched the RecastNavMesh Actor is duplicated from editor to runtime level like any other Actor and detour nav data can be then accessed in game (it’s a pointer named DetourNavMesh inside PimplRecastNavMesh).

Now, I am trying to setup a custom NavigationData Actor for learning purposes. Following recast workflow I build nav data in the Editor and I store collected information (like NavLinks) inside my NavigationData Actor but this data is then not available in the runtime instance during PIE. My question is: how does this work for RecastNavMesh? How is data built in the Editor available at runtime?

Thanks for any hint!

Ok, I realise this is a niche question but for whoever might find it interesting I will post my findings here.

Making use of the debugger I managed to figure out how Navigation data is loaded in a Game Instance, at least on a high level: it is through the Serialization Framework of UE. It is useful to remember that ARecastNavMesh is a subclass of AActor. This means it exposes a Serialize method. That method is called 2 times upon PIE:

  1. To save
  2. To load (and here, when the FArchive is in loading phase, a new dtNavMesh is allocated dynamically, in FPImplRecastNavMesh::Serialize)

How the whole serialization process works is a topic on its own but if I manage to figure it out I’ll be posting my findings here or -if my willpower will be particulary strong on that mighty day- in a blog post.

Hope this overview might still help some lost soul out there.

Found a partial answer: the recast navigation data is loaded as part of the Serialize method on the NavigationData Actor.