mod.path
in the game's console (open via F7
).mod.interfaces
in the game's console.F7
to open the game's consolemod.create MyModName
in the console.
.csproj
file holds information about the C# project structure of the mod.modinfo.yml
.modinfo.yml
can be accessed by the user in the game without enabling the mod.IModSettings
are saved and loaded from the file modsettings.json
of their corresponding mod folder.Not all of the app domain (i.e. loaded libraries) is exposed to mods by default.
To make all types from an assembly (e.g. Newtonsoft.Json
) available to your mod, specify the assembly in requiredAssemblies
of modinfo.yml
.
To make specific types in an already loaded assembly (e.g. System.Uri
) available to your mod, specify the type in requiredTypes
of modinfo.yml
.
System.Uri
from the assembly mscorlib
) must be loaded using this field because requiredAssemblies
cannot be used to load the standard library a second time.You can find the assembly of a type using go to declaration
of Visual Studio Code (see below video).
a-MyCoolFile.cs
would be loaded before b-MyAwesomeFile.cs
mod.eval
command.
mod.eval (UnityEngine.Debug.Log("Hello world!"))
mod.eval (using UnityEngine)
mod.eval (Debug.Log("Hello world!"))
mod.eval (using UnityEngine.UIElements)
mod.eval (GameObject.FindObjectOfType<UIDocument>().rootVisualElement.Q("logo").style.opacity = 0.1f))
ThisIsWrong()
and check that an error marker appears as expected.modinfo.yml
specifies all required assemblies in the requiredAssemblies
field or specific types in the requiredTypes
field.UnityEngine.Debug.Log
to write information to the game's console.