Surfaces
public static class SurfacesNamespace Sideload.Api
Added in 1.13.0
HTML somewhere other than the phone: a column in the main menu, a panel on a machine, a board on a wall.
The renderer never cared about the phone - it draws into any RectTransform - so a surface is the same engine, the same CSS subset and the same s1.call / s1.on channel, only mounted somewhere else. What it does not have is everything that belongs to the phone: no home-screen icon, no orientation the player can turn, no badge, no notification.
Surfaces.Mount(myPanelRectTransform, "sidehustle-menu", "SideHustle.Assets.menu") .OnCall("menu.state", _ => StateJson());Needs Sideload 1.13.0. Against anything older Mount answers a handle whose calls are no-ops and Available is false, so a mod ships this without a hard version pin and keeps its own UI as the fallback.
Properties
Section titled “Properties”Available
Section titled “Available”public static bool Available { get; }Added in 1.13.0
Whether the installed Sideload can render outside the phone at all.
Methods
Section titled “Methods”public static SurfaceHandle Mount( object hostRect, string id, string bundlePrefix, float designShortSide = 0f, Assembly hostAssembly = null)Added in 1.13.0
Render a bundle into a panel of your own.
| Parameter | |
|---|---|
hostRect | Your UnityEngine.RectTransform. Typed as object only so this file stays compilable in a mod with no Unity reference; pass the RectTransform straight in. |
id | Stable id, unique across apps AND surfaces - they share one namespace, so a surface cannot take an app’s s1.call handlers. Also the folder under Mods/ that overrides the bundle. |
bundlePrefix | Embedded-resource prefix of the web files inside the calling assembly. |
designShortSide | What the panel’s short side is worth in CSS pixels. 0 (the default) maps one CSS pixel to one device unit, which is what a panel uGUI has already laid out wants. Give a number instead to get the phone’s contract: the page is written for that width and scales with the panel. |
hostAssembly | The assembly holding the bundle. Defaults to the caller’s. |
Unmount
Section titled “Unmount”public static void Unmount(string id)Added in 1.13.0
Take a surface down. Safe for an id that was never mounted.
IsMounted
Section titled “IsMounted”public static bool IsMounted(string id)Added in 1.13.0
Whether a surface under this id is on screen. False once its panel is destroyed - a scene reload does that - so this is the check to remount on.