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
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
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
While you can access game scripts within methods, parameters, attributes etc.
You specifically cannot store the reference of game scripts within a class as Unity will then attempt to serialize them even if you mark them as [NonSerializable]
which will break the DLL.
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