Everhood 2 Modding
  • Welcome
  • Getting Started
    • Setting up stuff
    • Create a world
    • Create a battle
  • Basics
    • Export a Mod
    • Test Mod From Hilbert Hotel
    • Test Mod faster from Menu
    • Battle Editor
    • Upload / Update a mod to Steamworkshop
    • Custom coding
    • Dialogues Rich Text Sheet
  • Help
    • My mod is pitch black
    • Join our Discord for help
Powered by GitBook
On this page
  • Setting up a new code DLL
  • Open Visual Studio > Create a new project > Class Library
  • Give the project any name, the name of the project will be the name of the DLL. 3.
  • Set the project framework to '.NET Standard 2.1'.
  • After the project loads go to Project > Add Project reference... > Browse...
  • Create any scripts you want to use in the custom world.
  • Using the DLL in Unity
  • Build the project by going to Visual Studio > Build > Build Solution
  • You'll find your exported dlls in '[Visual Studio project]\bin\Debug\netstandard2.1'.
  • In Unity disable Auto Reference and Validate References in the settings of your DLL
  • Updating the DLL in Unity
  • Storing references of game scripts
  1. Basics

Custom coding

PreviousUpload / Update a mod to SteamworkshopNextDialogues Rich Text Sheet

Last updated 3 months ago

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

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: