-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Kanisuko edited this page May 24, 2026
·
9 revisions
- Install BepInEx 5.x for Scav Prototype if you have not already.
- Download
ScavLib.dllfrom the DLL Repository. - Place
ScavLib.dllinto:/BepInEx/plugins/ScavLib.dll - Launch the game and open the developer console. Type
scavlib statusto confirm ScavLib loaded successfully.
In your .csproj, reference both BepInEx.dll and ScavLib.dll:
<Reference Include="BepInEx">
<HintPath>path\to\BepInEx\core\BepInEx.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ScavLib API">
<HintPath>path\to\BepInEx\plugins\ScavLib.dll</HintPath>
<Private>False</Private>
</Reference>Use [BepInDependency] so BepInEx loads ScavLib before your mod:
using BepInEx;
using ScavLib.util;
using ScavLib.event_bus;
using ScavLib.event_bus.events;
[BepInDependency("com.kanisuko.scavlib", "0.3.0")]
[BepInPlugin("com.yourname.yourmod", "YourMod", "1.0.0")]
public class YourPlugin : BaseUnityPlugin
{
private void Awake()
{
// Register event listeners defined in this class.
EventBus.Register(this);
Logger.LogInfo("YourMod loaded.");
}
// This fires once the game world is fully loaded and Body is safe to access.
[Subscribe]
private void OnWorldLoaded(WorldLoadedEvent e)
{
GameUtil.Alert("YourMod is active!", important: false);
}
}| Namespace | Contents |
|---|---|
ScavLib.util |
PlayerUtil, SkillUtil, ItemUtil, GameUtil
|
ScavLib.event_bus |
EventBus, BusEvent, [Subscribe]
|
ScavLib.event_bus.events |
WorldLoadedEvent, ItemPickedUpEvent, ItemDroppedEvent
|
ScavLib.item |
CustomItemRegistry |
ScavLib.command |
BaseCommand, CommandRegistry
|
ScavLib.config |
ConfigManager |
ScavLib.gui |
MenuWindow, MenuBuilder, MenuManager
|
ScavLib.mods |
ModInfo, ModRegistry
|
BepInEx calls Awake() before any game world exists. Accessing
PlayerCamera.main or Body at this point will throw a
NullReferenceException.
Always use WorldLoadedEvent as your entry point for anything that
requires the player to exist:
[Subscribe]
private void OnWorldLoaded(WorldLoadedEvent e)
{
// Safe to call PlayerUtil, SkillUtil, ItemUtil, etc. from here.
PlayerUtil.HealAll();
}All PlayerUtil, SkillUtil, and GameUtil methods are null-safe and will
return default values (0, false, null) when called outside a loaded
world, but they will silently no-op rather than throw. Subscribe to
WorldLoadedEvent to ensure your logic runs at the right time.