# How to stack or set priority to area classes / nav modifiers

**URL:** <https://forums.unrealengine.com/t/how-to-stack-or-set-priority-to-area-classes-nav-modifiers/499193>\
**Category:** AI\
**Tags:** pathfinding, Navigation, unreal-engine, UE4-26, question\
**Created:** [February 17, 2022, 3:59pm UTC](https://forums.unrealengine.com/t/how-to-stack-or-set-priority-to-area-classes-nav-modifiers/499193 "2022-02-17T15:59:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lordlolek](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lordlolek/32/906205_2.png) [@lordlolek](https://forums.unrealengine.com/u/lordlolek)\
**Post date:** [February 17, 2022, 3:59pm UTC](https://forums.unrealengine.com/t/how-to-stack-or-set-priority-to-area-classes-nav-modifiers/499193/1 "2022-02-17T15:59:10Z")

</div>

Hi,  
I have a custom area class (let’s call it Wall) which is walkable for an AI but only if it meets the certain condition, otherwise I set nav filter to not walk trough it - this part works.

The problem is -I have a second area class that is always walkable but with higher cost, and what happens is sometimes the walkable one overlaps with the Wall class and it overrides it so the AI doesn’t know there is this Wall class, they only see the walkable one.

here’s preview, in the highlighted square there should be a yellow-ish navmesh color (Wall class) but it got overriden with the walkable grey one

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/2/7/827cc986605b1ba4a7dc83263d67a2a19b72f0c9.jpeg)

I was trying to find an answer online, area class priority ideally, but with no luck, what would you do in this situation?

(engine v. 4-26)

---

<div class="post-metadata">

**Author:** ![lordlolek](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lordlolek/32/906205_2.png) [@lordlolek](https://forums.unrealengine.com/u/lordlolek)\
**Post date:** [February 17, 2022, 4:29pm UTC](https://forums.unrealengine.com/t/how-to-stack-or-set-priority-to-area-classes-nav-modifiers/499193/2 "2022-02-17T16:29:06Z")

</div>

It turns out I’m just bad at looking for the answer. Shortly after posting I’ve found this post and it resolves the problem for me

> [@Having problems with overlapping Nav Modifiers](https://forums.unrealengine.com/t/having-problems-with-overlapping-nav-modifiers/395147/2):
>
> You can enable ares “sorting” in Project Settings \> Navigation Mesh \> Sort Navigation Areas by Cost. Once enabled the navmesh generator will sort areas to be applied based on their cost making sure the most expensive areas end up on top. Of course this is not always what you want, so you can override the function that does the actual sorting, ARecastNavMesh::SortAreasForGenerator Cheers, –mieszko
