Tip: How to increase pathfinding distance

I had to calculate a long navmesh path for an actor and had a lot of trouble to find any info on this, so I’d like to post what I found out, in case it helps anyone.

I had to create my own UNavigationQueryFilter child and override InitializeFilter like this:

void USuperCoolNavQuery::InitializeFilter(const ANavigationData& NavData, const UObject* Querier, FNavigationQueryFilter& Filter) const
{
	Super::InitializeFilter(NavData, Querier, Filter);
	Filter.SetMaxSearchNodes(8192); // Default == 2048
}

Then I could use this class (or another derived from it) as FilterClass in FindPathToLocationSynchronously node.
That’s it!

Also, before anyone asks, adding

[/Script/Engine.RecastNavMesh]
 DefaultMaxSearchNodes=4096

to DefaultEngine.ini wasn’t an option for me because 1- it didn’t do anything for some reason, 2- it’s global, and I needed to do it for a single actor, so there was no need to globally change that.