-
Notifications
You must be signed in to change notification settings - Fork 0
API Documentation
There 5 override functions you can add:
public override void OnEnable() { }Gets called when your mod loads
public override void OnDisable() { }Equivalent of Unity's OnApplicationQuit()
public override void Update(float deltaTime) { }Unity's Update() function, passing the Time.deltaTime value
public override void FixedUpdate(float fixedDeltaTime) { }Unity's FixedUpdate() function, passing the Time.fixedDeltaTime value
public override void OnGUI() { }Unity's OnGUI() function. You can use this to render Unity ImGUI
(this documentation can also be found in Visual Studio IntelliCode/IntelliSense)
Additionally, the Loadson.Mod base class gives you three more methods you can call on your instance:
LoadAsset<T>(name);Loads an asset from your asset bundle. (see Compiling your mod, Asset bundles)
AddAPIFunction(name, execute);Create an API function.
Be careful to include a prefix in your API functios, and try to respect the guid.function_name format
Additionally, see [writing a good API]
execute is a lambda taking in an object[] array and returning an object
CallAPIFunction(name, args);Call an API function.
args is an object[] array
returns an object
GetUserFilesFolder()Get User Files directory where you can store any files.
returns a string
There is only one available function:
Loadson.Console.Log(string);Log a string to the internal console and log file
There is only one available function:
Loadson.Preferences.GetPreferences()Get your set preferences. All modifications to the dictionary are automatically saved. You can use it to store different key,value pairs for configuration
returns a Dictionary<string, string>
To save you the hustle of creating a GameObject, component etc. and calling a Coroutine, you can simply use the Coroutines class.
LoadsonAPI.Coroutines.StartCoroutine(coroutine);Equivalent of Unity's MonoBehaviour.StartCoroutine() function
coroutine is an IEnumerator
returns UnityEngine.Coroutine
LoadsonAPI.Coroutines.StopCoroutine(coroutine);Equivalent of Unity's MonoBehaviour.StopCoroutine() function
coroutine is UnityEngine.Coroutine
(this documentation can also be found in Visual Studio IntelliCode/IntelliSense)
Loadson has a custom main menu section, where every mod can register sub-category buttons that call a lambda function on click.
LoadsonAPI.MenuEntry.AddMenuEntry(list [,name]);Create the category for your mod.
list is List<(string, Action)> consisting of sub-category buttons (name, onclick)
name is optional. Display name of category
onclickisAction(void lambda with no args)
LoadsonAPI.MenuEntry.RemoveMenuEntry();Removes your mod's category
LoadsonAPI.MenuEntry.UpdateMenuEntry(list [,name]);Equivalent of successive calling of .RemoveMenuEntry(); and .AddMenuEntry(list); functions.
name is optional. Display name of category
Utility class for displaying custom text under the timer
LoadsonAPI.TimerText.AddText(text)Add text below the in-game timer. You can only use this method in your OnEnable() method
text is string lambda (no parameters, returns a string) (eg. ()=>"Hello, world!" ; This way you can show dynamic text)
Unity ImGUI windowId dispatcher.
LoadsonAPI.ImGUI_WID.GetWindowId();Use this in your OnEnable (or other calls from within) to set window id's, so they're unique and don't override accidentally. Returns the next unique windowId.
Instance basic props. The following functions all have the same effect (creating an instance), just different objects:
.NewPistol();-
.NewAk47();(Uzzi) .NewShotgun();.NewBoomer();-
.NewGrappler();(fixed red dot) -
.NewDummyGrappler();(red dot is not fixed, use it to give to enemies / display) -
.NewTable();(fixed legs) .NewBarrel();.NewLocker();-
.NewScreen();(the monitor object) -
.NewEnemy();(keep in mind that this is originally instanced from Tutorial) .NewMilk();.NewCube();.BounceMaterial();.NewGlass();
Loadson's interface with Discord. This documentation is also available in IntelliSense/IntelliCode
-
.Discordthe Discord interface -
.Userthe Discord user -
.Bearerthe Discord Bearer for authentication -
.HasDiscordcheck if the user has Discord installed