-
Notifications
You must be signed in to change notification settings - Fork 3
Plugins
VNyan supports custom unity scripts through C# assemblies (as of v1.2.1).
To use the mods in VNyan you'll need to drop the new DLLs to VNyan's folder under Items\Assemblies.
You'll also need to go to the Misc-settings in VNyan and click the toggle to allow loading 3rd party mods/plugins. Finally restart VNyan
- Plugin auto-start
- Plugins can register their own buttons in the Plugins button list
- Plugins can have their own settings window.
To use custom unity scripts in your props, custom objects, worlds etc you'll need to create a C# Assembly. The steps to do this are relatively simple but you'll need to make sure you have the correct versions of applications and libraries or things will not work
Requirements
- Visual Studio 2019
- Unity 2020.3.48f1
- VNyan v1.2.1 or later
First step is to launch up Visual Studio 2019 and create a new project.
You'll need to create a Class Library-style project that targets .NET Standard and .NET Core. Give the project a unique name so your assembly will not conflict with other assemblies.
The Project needs to be set to target .NET Standard 2.0.
After this you have your project set up.
In order to use any part of Unity, it's necessary to add UnityEngine.dll to the project. This specific DLL needs to be added from Unity 2020.3.48f1. You can find it from the directory where Unity has installed your Unity Editors.
Simply right click on the Dependencies in your Visual Studio project and select "Add Project Reference". After this click the "Browse"-button and find the UnityEngine.dll. In my case this file was in Program Files\Unity\Hub\Editor\2020.3.48f1\Editor\Data\Managed-folder
Now you're ready to code your Unity c# scripts as classes. Make sure that you use MonoBehaviour as the base class for all the classes that need to be added to GameObjects in Unity.
Once you're done with your classes you need to build a Release-version of the library. This will generate a DLL-file.
After you have the DLL file, all you need to do is drop that DLL in your Unity-project where you have your prop or custom item. Once the DLL has loaded into Unity, there should be a small arrow on its icon in Assets-folder. By clicking that it'll show all the scripts inside the dll. Now you can simply drag and drop them on your components.
Finally export your custom object.
Download ExamplePlugin.zip and drop the 2 files in release folder to the Items\Assemblies
. This will then add a button to the new plugin window. You can click the button and it'll open/close a test window you can drag around.
VNyan - https://suvidriel.itch.io/vnyan