Custom Scripts
Custom scripts are a powerful way of doing unique and complex stuff in your level that are either too difficult to accomplish with present scripts or impossible to do so. With custom scripts you can control your level and the game itself(partially) however you want.
Prerequisites
- Knowledge of C# programming language and Unity API:
- Visual Studio 2022(Windows Only)
- BepInEx Templates(if not installed, run
dotnet new -i BepInEx.Templates --nuget-source https://nuget.bepinex.dev/v3/index.jsonin the command line) - BepInEx nuget source(run
dotnet nuget add source https://nuget.bepinex.dev/v3/index.json --name Bepinexin the command line) - ULTRAKILL Custom Scripts Template
You are not restricted to use Visual Studio 2022 specifically. If you wish, or if you are on other non-Windows OS, you can use different C# IDE-s. For example Rider. This page will assume you are using Visual Studio 2022. If thats not the case, you can refer to the documentation of your IDE regarding the installation of templates and compiling into .dll files.
Creating the projects
Extract the ULTRAKILL Custom Scripts Template zip file(listed above) into the C:\Users\{User Name}\Documents\Visual Studio 2022\Templates\ProjectTemplates directory(may wary depending on what IDE you are using, in that case refer to the documentation of that IDE regarding the installation of project templates). Close your IDE if its open. Afterwards create a new project using the template and create your scripts.
- Do not use BepInEx types as fields (even if static) in unity scripts (like MonoBehavior or ScriptableObject). Put them in another class instead. For example, if you want to patch a method create a static method to contain the Harmony object and patch methods
- Do not derive from UnityPlugin
After you are done, compile the scripts into a .dll file(CTRL+Shift+B hotkey). Your .dll file will be placed in the bin folder. Copy it into the Rude\Assets\RudeScripts and {Game folder or profile folder(if using a mod manager)}\BepInEx\plugins\EternalsTeam-AngryLevelLoader\AngryLevelLoader\Scripts directories. Now compile the level and test your scripts!
DO NOT create or add any script files (.cs) directly into rude. This will break rude. Instead, create a .dll file using the section above, and add it to your RudeScripts folder. This will make it appear as a component that can be added to objects.