Custom coding

It is possible to have custom scripts inside your mod. For that, you will need to setup a new DLL and tied to Everhood 2 and Unity.

Setting up a new code DLL

1

Open Visual Studio > Create a new project > Class Library

2

Give the project any name, the name of the project will be the name of the DLL. 3.

3

Set the project framework to '.NET Standard 2.1'.

4

After the project loads go to Project > Add Project reference... > Browse...

Use CTRL+A to select all DLLs under '.\Everhood2\Everhood 2 Data\Managed'

and use CTRL+[Left Click] to deselect 'netstandard.dll' and any DLLs starting with 'System'.

5

Create any scripts you want to use in the custom world.

You'll have access to all of Unity's features and can create a script that can be dragged into the inspector by having it inherit from MonoBehaviour.

You can also access classes from Everhood 2 that you can explore and analyze using dnSpy and sinai-dev/UnityExplorer.

Using the DLL in Unity

1

Build the project by going to Visual Studio > Build > Build Solution

2

You'll find your exported dlls in '[Visual Studio project]\bin\Debug\netstandard2.1'.

From there find the dll that matches your project name and place it somewhere in your Everhood 2 Unity mod folder.

3

In Unity disable Auto Reference and Validate References in the settings of your DLL

Updating the DLL in Unity

To update the dll build the project and replace the dll using file explorer, Unity will do the rest.


Storing references of game scripts

This will not work:

The workaround is to store the reference as "object" like this and then Cast it back to the target class:

Then Cast, an efficient method could be for example:

Last updated