LostEnemyFix

版本 v1.1.1·更新於 2026-04-19

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

截圖 共 4 張

模組介紹 作者原文

v80 Update

Zeekerss implemented the following code implementing part of this mod to the base game:

if (agent.isOnNavMesh)

{

if (destination!= prevDestination && agent.SetDestination(destination))

{

prevDestination = destination;

}

}

else

{

Debug.LogError($"Agent '{enemyType.enemyName}' #{thisEnemyIndex}: Agent not on nav mesh when trying to set destination", base.gameObject);

}

The issue is this implementation just spams a brand new error every frame and does not do anything to fix the problem, yet broke my prior implementation by checking for the same issue before calling SetDestination.

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.

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)

Without This Mod:

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.

安裝與使用 安裝:BepInEx 外掛

  1. 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
  2. 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
  3. 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
  4. 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。

帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。

前置依賴

下面這些內容需要先安裝,否則該模組不會生效:

BepInEx-BepInExPack

檔案與校驗

檔案名稱
LostEnemyFix-1.1.1.zip
檔案大小
135.6 KiB