Apps
public static class AppsNamespace Sideload.Api
The Sideload framework’s modder API. Reference Sideload.Api.dll OR drop this single file into your mod. Register an app and Sideload renders your HTML/CSS/JS bundle as a real phone app - no uGUI assembly by hand, no layout arithmetic, hot-reloadable while the game runs.
Every call is a zero-overhead no-op when Sideload is not installed and lights up automatically when it is, so you can ship this unconditionally with no hard dependency. Check Available only if you want to fall back to your own UI.
using Sideload.Api;Apps.Register("prophunt", "PropHunt.App", title: "PropHunt", iconLabel: "PropHunt");The bundle prefix is the embedded-resource prefix of your web files inside your own assembly, so PropHunt/App/index.html embedded as PropHunt.App.index.html is reached with prefix "PropHunt.App". A file at Mods/<id>/index.html overrides the embedded copy.
All calls MUST be made from the Unity main thread.
Ids are compared case-insensitively and trimmed. Call and event names are compared case-insensitively. A bundle path is resolved in two places, and the file on disk wins: Mods/<id>/<path>, then the embedded resource <bundlePrefix>.<path with / turned into .>. So css/app.css with prefix "MyMod.Assets.mystash" is the resource MyMod.Assets.mystash.css.app.css.
Example
The csproj embeds the web files under the prefix you pass to Register:
<EmbeddedResource Include="Assets/mystash/*"> <LogicalName>MyMod.Assets.mystash.%(Filename)%(Extension)</LogicalName></EmbeddedResource>Then in OnInitializeMelon:
Apps.Register("mystash", "MyMod.Assets.mystash", title: "Stash", iconLabel: "Stash") .OnCall("items.list", _ => string.Join("\n", Items)) .OnCall("items.add", text => { Items.Add(text.Trim()); return "ok"; });Properties
Section titled “Properties”Available
Section titled “Available”public static bool Available { get; }True only when the Sideload host is installed AND bound. You rarely need this - the API is a safe no-op when absent; use it to decide whether to build a fallback UI instead.
Methods
Section titled “Methods”Register
Section titled “Register”public static AppHandle Register( string id, string bundlePrefix, string title = null, string iconLabel = null, Assembly hostAssembly = null)Types: AppHandle
Declare an app. It appears on the in-game phone with its own icon and renders index.html from your bundle. Load-order-proof: registering before Sideload has loaded is fine, the call is replayed once the host appears.
| Parameter | |
|---|---|
id | Stable, unique id, e.g. “mystash”. Also the folder name under Mods/ that overrides the embedded files. Compared case-insensitively. Registering the same id again replaces the earlier app. Null or empty registers nothing and returns a handle whose calls do nothing. |
bundlePrefix | Embedded-resource prefix of your web files inside the calling assembly, e.g. “MyMod.Assets.mystash” for MyMod.Assets.mystash.index.html. It is the LogicalName prefix in your csproj. Null means no prefix. |
title | App title, e.g. “Stash”. Null or blank uses id. |
iconLabel | Caption under the home-screen icon. Null or blank uses the title. |
hostAssembly | The assembly holding the embedded bundle. Defaults to the caller’s assembly; pass it explicitly if you wrap this call in a helper of your own. |
Returns The handle for the app’s calls, events, badge and notifications. Every method on it chains.