The pages in this section will guide you through setting up your modding environment and installing essential mod developer tools.
Loading...
Loading...
Loading...
As described in Max's guide on mod.io, the modding SDK comes with some examples packaged in a zip file. Let's take a look at some of them.
After your SDK project is set up, go to your file explorer and unzip the /Assets/Examples.zip
file into the Assets folder such that you have a folder /Assets/Examples
with a bunch of example subfolders.
In the Unity Editor, use a Project browser to navigate to the /Assets/Examples/ItemExample
folder. Here you can see the files used by this example, which introduces a new weapon called "Sword1".
By inspecting SpawnItemOnStart.cs
you can learn that the example is coded to create a dropped item instance of the custom item near spawn every time the game is loaded. This obviously is not what an end user would want, but it works well enough for our testing purposes.
To package the mod and try it out in-game, first open the Mod SDK tab. If you've lost it, you can open a new one via (Top bar) PugMod
> Open Mod SDK Window
.
Click the Mod Settings
button to open the packaging UI, select ItemExample
from the "Mod" dropdown, then click Install Mod
. This will open a popup prompt and take at least a few seconds to execute. Once it's complete you'll see this popup:
Launch the game and notice that the main menu's Mods button says you have 1 mod loaded (assuming you don't currently have any other mods loaded). If you were to go into this mods menu, the ItemExample mod would not show up because it has been installed outside of the mod.io ecosystem. This is to be expected for locally installed mods.
If you want to remove this mod, go to your mod install directory and delete the ItemExample
folder.
Load into a world and go near the Core - you'll find a Sword1 item on the ground.
Max at Pugstorm maintains a guide for accessing and installing the modding SDK on mod.io guides.
Follow Max's guide up until you reach the "Creating new objects" header. You can keep reading from there if you'd like, but it may not make sense without further context. This site will walk through some more specific examples in the next few pages.
As Max is the only person with edit permissions, the mod.io guide can easily fall out of date. If something needs to be updated, discuss it in the #mod-creators channel on the official Core Keeper Discord.
There are a few extra steps you need to take that Max's guide doesn't mention.
In the Unity Hub, add the -disable-assembly-updater
command line argument to your SDK project. If you don't do this, the Pug.Other.dll
and Pug.ECS.Components.dll
will not load correctly, meaning you will be missing some important script components.
As you may have noticed when inspecting the ItemExample's SpawnItemOnStart script, in addition to spawning an item, it also prints "Spawn Sword1" to the game's debug logs. This section will explain how to view those logs.
The Player.log
file in your log files directory contains log messages from the active (or previous, if the game is currently closed) game session. Open it up and ensure you can find the "Spawn Sword1" message using your favorite text editor's Find utility.
A recommend way to easily view logs in real time is using BepInEx console. It will open together with the game and you will be able to see all logs there.
Setup steps:
Open game installation directory, and extract downloaded archive into game folder.
Ensure you see CoreKeeper.exe
and a folder on the same level called BepInEx
Note: BepInEx console has some limitations, specifically if you log from threads other than main (That often happens if you log from jobs) you won't see them. To see them you will have to watch Player.log
Viewing the logs in real time requires a text editor that can handle opening a file read-only without locking it. Consider Klogg or Notepad++.