The basics weren't good enough? Here's some more tools that you can use!
Here is some extra content and information that will help you on your way to creating a plugin. Inspecting the source code, accessing private settings, and using external libraries are all things Beat Saber plugins do, so why leave you off with just the basics?
Here are programs and libraries that allow you to go more advanced with your plugins and will help you greatly if you decide to explore new territory in Beat Saber modding. Remember, the Beat Saber Modding Group is always here for your programming help!
This is heavily unfinished! If you wish to cover a library, or an aspect of modding, please DM me on Discord
Caeden117#0117and let me know what to add.
If you find yourself tired of having to copy your finished builds from deep inside your project folder to the Plugins folder of your Beat Saber install, this will help you minimize the hassle needed by only just needing to Build your project, and open Beat Saber to test.
symlink is something that tells Windows that one file is actually linking to another directory. This is useful if you want a folder on your Desktop that goes straight to your Beat Saber directory when you open it, or in our case, have a symlink from our plugin in our Plugins folder to the latest builds in our build directory.
If any directory has spaces (Example:
cd C:\Users\Test\Hello World), encase the path in quotations:
cd "C:\Users\Test\Hello World"
- Open Command Prompt as Administrator.
- Make sure you do not have your plugin inside your Plugins folder.
- Have Command Prompt point to your Beat Saber Plugins folder (
cd <Beat Saber Directory>/Plugins)
- Execute the following command:
mklink <Plugin Name>.dll, <Path to your build file>
Here's an example of the
mklink ExampleMod.dll, "C:\Users\You\Documents\Visual Studio 2017\Projects\ExampleMod\ExampleMod\bin\Debug\ExampleMod.dll"
If all is done correctly, the next time you build your plugin and launch Beat Saber, the plugins should update automatically.
Another way to go about this is taking advantage of C#'s post-build events. This not only allows you to copy files to a directory when build is complete, but you can also do a lot more. Here is some documentation on pre/post build events
<Project Name> Properties...
- Copy and paste the following code into the Post-build event command line:
copy /Y "$(TargetPath)" "<Path to Beat Saber Plugins folder (Including the file name and extension)>"
- Save and exit.
Here's an example of the post-build command:
copy /Y "$(TargetPath)" "D:\Oculus\Software\Software\hyperbolic-magnetism-beat-saber\Plugins\ExampleMod.dll"
$(TargetPath) specifies the location of the file you are building, no matter where it's being built from.
If all is done correctly, the next time you build your plugin, a copy will be automatically sent to your Plugins folder (Automatically overwriting any previous version), and Beat Saber is ready to play.
dnSpy is a .NET debugger and assembly editor that allows you to import compiled
.dlls and view them decompiled into C#.
In the case of modding, we can use dnSpy to view the source code of Beat Saber and find methods and variables that would be handy to have for some plugins.
Read more about it here.
Download the latest release of dnSpy.zip.
Then extract the zip, and run
If all has been done correctly, things should look something like this, without the large list of files on the left side.
Then go to
File >> Open, then locate and open the compiled Beat Saber code located in
\<Beat Saber Directory>\Beat Saber_Data\Managed\Assembly-CSharp.dll
You can also use dnSpy to view and even edit the code of plugins, even those that have not yet published to GitHub. Be wary, though! Snooping around in other's code without permission is a bad idea.
Harmony is a library for patching compiled .NET and Mono methods during runtime.
This allows editing of core Beat Saber functions and allows plugins to achieve things way beyond what basic Illusion Plugin Architecture can achieve.
Read more about it here.
Download the latest release of Harmony
/<Beat Saber Directory>\Beat Saber_Data\Managed.
Add Harmony as a reference (Click here if you forget how to add a reference to your project).
Plugins that utilize Harmony require the
0Harmony.dllfile inside of
/<Beat Saber Directory>\Beat Saber_Data\Managed. Add a try-catch statement when you patch the game so the plugin doesn't crash when starting without Harmony.
Coming soon™, I'm gonna try to not have this be Mod Tutorial long, but should let you get a basic idea of how to use Harmony.
ReflectionUtil is a simple file that allows grabbing and setting private variables inside of files.
This is used in conjuction with dnSpy to search for and retrieve variables in code. Looking to modify private variables? Consider using Harmony instead.
Reflection Util is available in many mods, so here is one from Beat Saber Utils
From Beat Saber Utils
If you haven't already, add Beat Saber Utils as a reference to your project.
From there, add
using BS_Utils.Utilities; to the top of your file.
Access it using
Creating Your Own
Create a new file called
Copy and paste the above code to the newly created file, making sure to replace
namespace BS_Utils.Utilities with the name of your project.
Here is a basic use case of
ReflectionUtil, by grabbing the two sabers from the