You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For reference, trying to use this with Valheim. I've added ScriptEngine.dll to the plugins folder and it seems to fire up normally; [Info : BepInEx] Loading [Script Engine 11.0]
I press F6 to reload the scripts and get these log message (auto-load off, but same result with it on);
[Info :Script Engine] Loading plugins from C:\Program Files (x86)\Steam\steamapps\common\Valheim\BepInEx\scripts\ValheimTest.dll
[Info :Script Engine] Unloading old plugin instances
[Info :Script Engine] Loading plugins from C:\Program Files (x86)\Steam\steamapps\common\Valheim\BepInEx\scripts\ValheimTest.dll
However, neither of my patches are applied and neither does Awake or OnDestroy for the plugin execute. Seems like it simply doesn't do anything, no errors, no warnings, no debug messages.
If I cut and copy ValheimTest.dll from the scripts folder and put it in the plugins folder - it works as expected.
This looks to be a regression from 10.0 to 11.0
I got the same output while trying to get it to work on the Haste Broken Worlds Demo. Downgrading to 10.0 made it work.
Also may or may not be relevant, but on the Haste Broken Worlds Demo it only works with HideManagerGameObject = true
Can confirm modding Lethal Company. ScriptEngine is installed and finds the dll in BepInEx/scripts, but the Awake() function of the plugin is never called.
[Info :Script Engine] Loading FarawayFriends
[Message:Script Engine] Reloaded all plugins!
the Awake() is also never called for the plugin. When I try to reload it via the keybind nothing happens. When I use the FileSystemWatcher instead, I only get this
Getting the same issue here for "Stationeers" with BepInEx version 5.4.23.4. Maybe I'm different though as I'm developing on Linux running the game through Proton. Putting my dll in the normal /plugins directory works just fine, but /scripts does not work. It sees the mod, but never loads Awake()
For my case, I had to modify ScriptEngine a bit to handle the case of Chainloader.HideManagerGameObject being true
tl;dr:
Some games can destroy ScriptEngine's root after Awake is called causing Update to never get called (Causing keybinds to just break)
When fixed by setting ChainLoader.HideManagerGameObject to true loading mods throws a NRE.
In my case, Repo was destroying the BepInEx_Manager after Awake is called. So Update would never get called. Additionally this would destroy the scriptManager in ScriptEngine since ReloadPlugins (that recreates scriptManager) is only called during Awake and on Update. This causes a case where scriptManager is null when trying to add the reloaded mod to scriptManger, throwing a NRE.
My solution was modifying the coroutine for loading the dll to be something like this instead:
Then LoadDLL doesn't take a GameObject parameter anymore, instead we do this:
- var instance = obj.AddComponent(type);+ var instance = GetOrCreateScriptManager().AddComponent(type);
This prevents the following error:
[Error :Script Engine] Failed to load plugin FarawayFriends because of exception: System.NullReferenceException
at (wrapper managed-to-native) UnityEngine.GameObject.Internal_AddComponentWithType(UnityEngine.GameObject,System.Type)
at UnityEngine.GameObject.AddComponent (System.Type componentType) [0x00001] in <e4fea505ac6a4f7abd6784308d558cd0>:0
at ScriptEngine.ScriptEngine+<>c__DisplayClass40_2.<LoadDLL>b__1 () [0x0001b] in D:\SVN\BepInEx.Debug\src\ScriptEngine\ScriptEngine.cs:188
Activity
MeGaGiGaGon commentedon Mar 24, 2025
This looks to be a regression from 10.0 to 11.0
I got the same output while trying to get it to work on the Haste Broken Worlds Demo. Downgrading to 10.0 made it work.
Also may or may not be relevant, but on the Haste Broken Worlds Demo it only works with
HideManagerGameObject = trueManlyMarco commentedon Mar 24, 2025
Probably caused by this? 4010d2c#diff-672fb7b075a59ec8b46f434842be7dc30347e9a77acd209cf42a83dfd89ed4ddR168-R169
Maybe the BepInEx version your plugin is built against is not the same as the version the game is running, though it's unlikely to be the cause.
The easiest way to find the issue would be for you to attach a debugger and step through the scriptengine reload method.
Packsolite commentedon Sep 23, 2025
Can confirm modding Lethal Company. ScriptEngine is installed and finds the dll in
BepInEx/scripts, but theAwake()function of the plugin is never called.JustArion commentedon Dec 16, 2025
I'm having a similar issue but on modding Repo.
the
Awake()is also never called for the plugin. When I try to reload it via the keybind nothing happens. When I use the FileSystemWatcher instead, I only get thisdbidwell94 commentedon Dec 27, 2025
Getting the same issue here for "Stationeers" with BepInEx version 5.4.23.4. Maybe I'm different though as I'm developing on Linux running the game through Proton. Putting my dll in the normal
/pluginsdirectory works just fine, but/scriptsdoes not work. It sees the mod, but never loadsAwake()LogOutput:
^^ My
Awake()log is never fired.ManlyMarco commentedon Dec 27, 2025
Awake will never be called until you press the reload hotkey.
dbidwell94 commentedon Dec 28, 2025
I finally got it to work. I had to put both my compiled dll AAAANNNDDD the *.pdb file in the
scriptsdirectory and reload.I think this is a good candidate for some documentation improvements :)
JustArion commentedon Dec 28, 2025
For my case, I had to modify ScriptEngine a bit to handle the case of
Chainloader.HideManagerGameObjectbeingtruetl;dr:
Awakeis called causing Update to never get called (Causing keybinds to just break)ChainLoader.HideManagerGameObjectto true loading mods throws a NRE.In my case, Repo was destroying the BepInEx_Manager after Awake is called. So Update would never get called. Additionally this would destroy the
scriptManagerin ScriptEngine since ReloadPlugins (that recreates scriptManager) is only called during Awake and on Update. This causes a case wherescriptManageris null when trying to add the reloaded mod to scriptManger, throwing a NRE.My solution was modifying the coroutine for loading the dll to be something like this instead:
Then
LoadDLLdoesn't take aGameObjectparameter anymore, instead we do this:This prevents the following error:
dbidwell94 commentedon Dec 29, 2025
Ah yes, this was my case as well.
Stationeersmodding was the same, needed to modifyHideManagerGameObjectManlyMarco commentedon Dec 29, 2025
@dbidwell94 @JustArion Does this PR fix your issue? #18 You can find builds in the CI output.
It sounds like it's different from the original issue, can anyone test if this makes it function in Valheim and Lethal Company as well?
dbidwell94 commentedon Dec 29, 2025
I'll have to check later to see if this solves the need for
HideManagerGameObjectManlyMarco commentedon Dec 29, 2025
You will still need it enabled in BepInEx.cfg if the game requires it.
JustArion commentedon Dec 29, 2025
@ManlyMarco I can confirm the PR works on Repo! (Of course given
Chainloader.HideManagerGameObjectis set to true)ManlyMarco commentedon Jan 1, 2026
Please reopen this issue if the problem persists in some of the games.