JacobG5-LostEnemyFix icon

LostEnemyFix

Fixes EnemyAI's that fail to locate NavMesh by killing them.

Last updated a month ago
Total downloads 50710
Total rating 7 
Categories Mods Bug Fixes Performance
Dependency string JacobG5-LostEnemyFix-1.1.0
Dependants 53 other packages depend on this package

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100

README

AAAAAAA ERRORS!!!!

Lost Enemy Fix

This mod throws more meaningful errors when an EnemyAi fails to path on Navmesh and kills enemies that throw too many of these errors.

If you play with modded moons, enemies, or interiors. You may have at some point experienced:

[Error : Unity Log] "SetDestination" can only be called on an active agent that has been placed on a NavMesh.

This error can be thrown for several reasons, making it sometimes hard to track the exact source. This could be from a modded enemy being set up wrong, incorrectly placed AI nodes, or blocked navmesh in any modded interior or moon. When this error is thrown this mod will additionally log the EnemyType, position, target destination, enemy behavior state, and if it is outside or inside the facility.

Giant Deleted

The Fix

In order to fix this lag and console spawn this mod will kill enemies that throw this particular error.

This is configurable:

Aggressive Kills an enemy after it has thrown ONE SetDestination Error.

Reasonable (Default) Kills an enemy after it has thrown several SetDestination Errors.

Off Leaves Vanilla behavior. (Console will be spammed)

With This Mod: (Aggressive Setting)

One Error And Cleanup

Without This Mod:

Many Errors

and it keeps going...

Note:

This mod replaces the call to an EnemyAI's Agent with a custom method. If the vanilla error persists creating lag, the culprit is likely a modded enemy that overrides or completely replaces the navigation method of the vanilla EnemyAI. This mod will fix all vanilla enemies and modded enemies that inherit from the vanilla EnemyAI.

Credits

Programming by JacobG5 (Me)

Nikki - Paid me to make this. & made icons.

ko-fi