-
Notifications
You must be signed in to change notification settings - Fork 38
Building the Mod
You used to just built a dll and put it in your plugins folder and run the game.
Simple times for simple men. We're big brain now.
Here's the folder structure of the final mod installation in your r2modman profile.
- The henry template will load your assetbundle from a folder next to your .dll named "AssetBundles".
- If you're doing language files (see the Generating Language files(under construction) page for details), you'll need a folder next to your .dll named "Languages".
- Soundbanks aren't required to be in a folder, so long as they are named with the .sound extension R2API will load them, but it's just nice for organization.
Take a gander at how we make this possible in the HenryTutorial\Build folder:
- Open up the manifest.json and change the "name" and "author" fields as you see fit.
- Now select these two items and zip them. the manifest.json and plugins folder need to be in the root of the zip
- you can then import this into r2modman using settings > profile > import local mod.
- This mimics how r2modman will download and install your mod from thunderstore when you upload it
- Now your mod should show up in R2Modman, however unlike downloading a mod online, r2modman won't automatically download all the dependencies.
- Make sure you have those installed as well. They are the ones listed in the manifest.json file
Of course, when you go to release your mod, as you (probably) know, you'll need to add an icon.png
and readme.md
.
Do not to upload a mod with the default henry assetbundle, as this will cause conflicts. Simply renaming the file will not suffice. Follow the tutorial to make sure your assetbundle has been rebuilt from unity with a different tag, or we will thanos snap your thunderstore upload
When you build a mod, you can set your visual studio .csproj to automatically run some commands after you build. We can use this to automatically copy our built mod into your r2modman profile folder, so you can run the game with your mod
- In the Visual Studio Solution Explorer, right click your .csproj and hit
- On the left, go to Build Events.
- You'll see that the HenryMod project already has some post-build commands I was using as I developed the tutorial.
- You can go here for a much more in depth guide on this. For now I'll just go through what we have here.
Username:
REM follow the Building Your Mod page on the henrytutorial wiki for more information on this
REM change this to your username (or add yours if you're working in a team or somethin)
if "$(Username)" == "Erikbir" set build=true
- set this to your PC username. If your repo is public careful not to doxx yourself
Copy your build
REM copy the built mod to our Build folder
copy "$(TargetPath)" "$(ProjectDir)..\Build\plugins"
- The weird "$()" stuff are macros. TargetPath is the path to your built dll, and ProjectDir is the directory of your project, clearly.
- Here we're stepping up one folder, to go to the HenryTutorial\Build\plugins folder, and copying our built .dll there.
Copy your AssetBundle
REM copy the assetbundle from our unity project to our Build folder
REM change these paths to your (now hopefully renamed) folders
if exist "$(ProjectDir)..\HenryUnityProject\AssetBundles\myassetbundle" (
copy "$(ProjectDir)..\HenryUnityProject\AssetBundles\myassetbundle" "$(ProjectDir)..\Build\plugins\AssetBundles"
)
- as the comments say, we also copy the assetbundle from the unity project to the build folder, so we don't have to manually drag it to our mod install every time we make a change in unity
- be sure to change the unity project folder and assetbundle names to what you renamed them
- you did rename them, right?
Copy your AssetBundle
REM copy the whole Build\plugins folder into your r2modman profile. This mimics how r2modman will install your mod
Xcopy /E /I /Y "$(ProjectDir)..\Build\plugins" "E:\r2Profiles\Blinx Returns\BepInEx\plugins\rob-henrymod\"
- now with a magical function called Xcopy, it will copy everything in your
plugins
folder to the your r2modman profile folder- this mimics how r2modman will install your mod when it's downloaded from thunderstore.
- find your r2modman profile folder by going to r2modman settings > locations > browse profile folder
- of course, change "rob-henrymod" to "author-name" according to the fields in your manifest.
- if you have followed the "Installing with r2modman" section above, a folder with this name should already exist that you can verify
- if it doesn't, the Xcopy command will create a folder at the specified path anyway, so just be mindful of that
- if you have followed the "Installing with r2modman" section above, a folder with this name should already exist that you can verify
happy building! any questions go and bother thetimesweeper