# UNavigationSystem Why MainNavData is null?

**URL:** <https://forums.unrealengine.com/t/unavigationsystem-why-mainnavdata-is-null/373571>\
**Category:** AI\
**Tags:** navigation-mesh, navmeshbounds, unreal-engine, UE4, CPP, question\
**Created:** [October 17, 2016, 12:12pm UTC](https://forums.unrealengine.com/t/unavigationsystem-why-mainnavdata-is-null/373571 "2016-10-17T12:12:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_6a86feef1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6a86feef1](https://forums.unrealengine.com/u/anonymous_user_6a86feef1)\
**Post date:** [October 17, 2016, 12:12pm UTC](https://forums.unrealengine.com/t/unavigationsystem-why-mainnavdata-is-null/373571/1 "2016-10-17T12:12:46Z")

</div>

I am accessing my NavMesh with the following code:

```
static UNavigationSystem* const NavMesh = UNavigationSystem::GetCurrent(GetWorld());

```

 ![111217-navmesh.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/3/b/a3bb1d151cbae8360d171b2e14b4a602b9db61c2.png)

But in debug MainNavData is NULL, but in the editor I have a fully set NavMeshBoundsVolume ( As you can see on pic 2)

 ![111218-navmesh2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/4/d/24d812d9e0df6ecca0636a812e034ad356894b0d.png)

What could be the problem? Without MainNavData I cant generate points for my characters

---

<div class="post-metadata">

**Author:** ![MieszkoZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MieszkoZ](https://forums.unrealengine.com/u/MieszkoZ)\
**Post date:** [October 17, 2016, 12:19pm UTC](https://forums.unrealengine.com/t/unavigationsystem-why-mainnavdata-is-null/373571/2 "2016-10-17T12:19:22Z")

</div>

It all boils down to when you access the `MainNavData`. It gets set lazily, meaning if it’s null when you try to get it (via the `GetMainNavData` getter) the registered navigation data instances will be traversed and main one will be picked. Try postponing your MainNavData use and see if it helps.

Cheers,

–mieszko

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6a86feef1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6a86feef1](https://forums.unrealengine.com/u/anonymous_user_6a86feef1)\
**Post date:** [October 17, 2016, 12:37pm UTC](https://forums.unrealengine.com/t/unavigationsystem-why-mainnavdata-is-null/373571/3 "2016-10-17T12:37:18Z")

</div>

I Am used GetMainNavData(), but it’s still null.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_cc8f596b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_cc8f596b](https://forums.unrealengine.com/u/anonymous_user_cc8f596b)\
**Post date:** [November 1, 2017, 2:11pm UTC](https://forums.unrealengine.com/t/unavigationsystem-why-mainnavdata-is-null/373571/4 "2017-11-01T14:11:03Z")

</div>

Hello,

Am confused when to use MainNavData and AbstractNavData, other than the code comments I haven’t found any documentation.  
We are experiencing problems in cooked builds when accessing AbstractNavData.

Switching to MainNavData solves the problem but breaks a different stuff in our navigation .

EDIT: apparently doing a full rebuild and cook fixes our problem. Is it always recommended to enable FullRebuild ? We discuss that for the changes we are making content wise, shouldn’t be necessary
