Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
(For modders) VRM injector plugin
Updated 3 weeks agoPlugin.cs with injector code. Replace folder paths with your own and you too can inject VRMs. Requires .net framework and BepInEx templates to compile. Recommend using visual studio.
.net: https://dotnet.microsoft.com/en-us/download visual studio: https://visualstudio.microsoft.com/downloads/ BepInEx plugin creation documentiation: https://docs.bepinex.dev/articles/dev_guide/plugin_tutorial/1_setup.html
Instructions:
-
1 Install Visual Studio and .net
-
2 Create a folder, open the folder, shift right click in the folder and open a powershell window.
-
3 paste the following commands.
dotnet --list-sdks
This will show if you've installed .net correctly, there should be at least one entry with a file path. If yes, then continue. If not, reinstall .net. Example output: 6.0.100 [C:\Program Files\dotnet\sdk]
dotnet new install BepInEx.Templates::2.0.0-be.4 --nuget-source https://nuget.bepinex.dev/v3/index.json
If this fails, most likely your antivirus is blocking nuget. Go to the third link above and scroll to the bottom of the article to see what a successful installation of BepInEx templates looks like.
dotnet new bepinex5plugin -n VRMHelper
This will create the project inside the folder. You should see Plugin.cs and VRMHelper.csproj inside the folder.
-
4 Open VRMHelper.csproj with Visual Studio. On the right side of the visual studio window you will see the 'search solution explorer', click on Plugin.cs in the explorer.
-
5 There will be some example code in the Plugin.cs, delete everything in it and paste in all of the code below.
using BepInEx;
using BepInEx.Logging;
using System.IO;
namespace VRMHelper
{
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
Logger.LogInfo($"{MyPluginInfo.PLUGIN_NAME} {MyPluginInfo.PLUGIN_VERSION} is loading...");
string targetPath = Path.Combine(Paths.GameRootPath, "VRMs");
// Possible source paths (most common ones first)
string[] possibleSources = new string[]
{
Path.Combine(Paths.PluginPath, "Draven-Draven_VRMs", "Draven_VRMs", "VRMs"), // current installed name
Path.Combine(Paths.PluginPath, "Draven_VRMs", "VRMs"), // direct
Path.Combine(Paths.PluginPath, "Draven_VRMs", "Draven_VRMs", "VRMs") // other variations
};
foreach (string sourcePath in possibleSources)
{
if (Directory.Exists(sourcePath))
{
CopyVRMs(sourcePath, targetPath);
return;
}
}
Logger.LogWarning("Could not find VRMs source folder in any expected location.");
}
private void CopyVRMs(string sourcePath, string targetPath)
{
try
{
if (!Directory.Exists(targetPath))
{
Directory.CreateDirectory(targetPath);
Logger.LogInfo("Created VRMs folder in game root.");
}
foreach (string file in Directory.GetFiles(sourcePath))
{
string fileName = Path.GetFileName(file);
string destFile = Path.Combine(targetPath, fileName);
File.Copy(file, destFile, true);
Logger.LogInfo($"Copied VRM: {fileName}");
}
Logger.LogInfo("VRM files copied successfully!");
}
catch (System.Exception ex)
{
Logger.LogError($"Error copying VRMs: {ex.Message}");
}
}
}
}
-
6 Replace the path definitions ("Draven-Draven_VRMs", "Draven_VRMs", etc) with your own folder structure. Here's a brief explanation of what you should put here: Download my pack and reference the folder structure. When you upload a mod to Thunderstore, it always puts the team name at the beginning of the top mod folder. So if your name is Human99, and your folder structure is MyVRMmod.zip/BepInEx/plugins/human99VRMs/VRMs then when you upload it, the zip file is going to get renamed to Human99-MyVRMmod.zip. So you'd need to change the paths to "Human99-MyVRMmod", "Human99VRMs", "VRMs". You can get away with just changing the first line of definitions, the rest are a fallback just in case Thunderstore decides to stop putting the team name at the beginning of the file.
-
7 Once all that is done, go to the top of the visual studio window and click 'build' and click 'build solution'. If this fails, make sure there aren't any typos in the Plugin.cs. (check for missing commas, quotations, etc). If there aren't, go to the solution explorer window and click on the C# VRMHelper file. Look under <PropertyGroup> and copy/add/change these entries:
<PropertyGroup>
<TargetFramework>net46</TargetFramework>
<AssemblyName>VRMHelper</AssemblyName>
<Product>My first plugin</Product>
<Version>1.0.0</Version>
<Authors>Draven</Authors>
<Description>Helper plugin to copy VRMs to game root.</Description>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<RestoreAdditionalProjectSources>
https://api.nuget.org/v3/index.json;
https://nuget.bepinex.dev/v3/index.json;
https://nuget.samboy.dev/v3/index.json
</RestoreAdditionalProjectSources>
<RootNamespace>VRMHelper</RootNamespace>
</PropertyGroup>
If everything is in order, the plugin should compile.
-
8 Once you've compiled the plugin, you can close Visual Studio. Check in the folder under VRMHelper/bin/Debug/net46 and grab the VRMHelper.dll
-
9 In your mod folder, place VRMHelper.dll in BepInEx/plugins/YOURMODNAME
-
10 Done C: