ST Image Loader
Downloads a picture from a link and shows it on a renderer or in a UI Raw Image, like VRChat's VRCImageDownloader.
Add it with Add Component → StageTime → ST Image Loader.
In a future SDK update, ST Image Loader will only load from an approved list of sources, and links to other sites will stop loading. The list will be published in these docs before the change. See the Roadmap.
| Field | |
|---|---|
url | The https link to a JPG or PNG image |
loadOnStart | Load when the world loads |
targetRenderer | Show the image on this renderer (optional). The material is not copied: the image is set on this renderer only |
textureProperty | The material's texture to replace; empty = its main texture (_BaseMap in URP) |
targetRawImage | Show the image in this UI Raw Image (optional) |
mipmaps | Make smaller copies so the image looks smooth from far away (on by default; uses a third more memory) |
filterMode, wrapMode, anisoLevel | How the image is sampled: blending, edges (Clamp by default), sharpness at steep angles |
cacheMinutes | Show a copy saved on the device for this many minutes instead of downloading again (default 60) |
| Member | |
|---|---|
result | The image after OnImageLoadSuccess (a Texture2D; null before and after Unload) |
width, height | Its size in pixels |
error | Why the last load failed |
isLoading, progress | A load is in progress; how much has arrived (0 to 1) |
Load(), LoadUrl(url) | Load again, or another link. The current image stays until the new one arrives |
Unload() | Free the image and show the material's own texture again |
Scripts on the same GameObject get OnImageLoadSuccess() and OnImageLoadError().
public class Poster : StageTimeBehaviour
{
public override void OnImageLoadSuccess()
{
STImageLoader loader = GetComponent<STImageLoader>();
transform.localScale = new Vector3((float)loader.width / loader.height, 1f, 1f); // keep the picture's shape
}
}
Limits
- JPG or PNG, at most 2048 x 2048 pixels and 16 MB. https links only.
- All of a world's image loaders share a limit of one new download per second; extra loads wait their turn. An image
loaded in the last
cacheMinutescomes from the device and doesn't wait. - A loader keeps one image. Loading another,
Unload()or destroying the loader frees the old one, so a gallery can flip through any number of pictures with one loader.
Same picture for everyone
Each player's device loads its own copy, and nothing about the image is synced. To show everyone the same picture,
sync which picture to show (a number or a link) and load it in OnDeserialization. The
Image gallery example does this.
Unlike VRChat, the events carry no parameter (read the loader's fields), links are plain strings (no VRCUrl), and
the loader shows the image on its targets for you, without copying the material.