CDN Setup For GigaSphere Tiles
This guide summarizes how TileLoader (Assets/Plugins/Revoid/GigaSphere/Scripts/Runtime/Tiles/TileLoader.cs) and the static Gigasphere facade (Assets/Plugins/Revoid/GigaSphere/Scripts/Runtime/Managers/Gigasphere.cs) expect external tile content to be hosted.
Prerequisites
- Mirror the folder hierarchy that lives under
StreamingAssets/Tiles(or the per-locationLocationInfo.tilesFolderoverride) on your CDN. File names and relative paths must match exactly becauseTileLoadercombines the CDN root with each location folder when composing tile URLs. - Tiles can be JPG or KTX2. KTX2 is preferred for bandwidth and decode performance.
- Ensure your CDN supports HTTP range requests and reasonable cache headers;
TileLoaderstreams tiles independently and benefits from partial caching.
Configuring At Runtime
Use Gigasphere.SetCdnUrl to point all locations at an external root. The method validates that the URL is absolute and HTTP/HTTPS before pushing it into TileLoader.SetExternalTileRoot.
using Revoid.GigaSphere.Managers;
public class CdnBootstrapper : MonoBehaviour
{
void Awake()
{
const string cdnRoot = "https://cdn.example.com/panorama_tiles";
Gigasphere.SetCdnUrl(cdnRoot);
}
}Passing null or whitespace to SetCdnUrl clears the override and falls back to the StreamingAssets folders.
If you need to temporarily point a single location at a different folder (while leaving the CDN root active) you can call TileLoader.SetTileFolderOverride directly, but remember to revert to avoid leaking the override to the next location.
Inspector Workflow
- Select the
TileLoaderin your scene. - In Tile Source Overrides set External Tile Root Url to your CDN base URL. The script normalizes the string, trims trailing slashes, and updates the effective tile base path immediately.
- Optionally adjust Tile Base Path to match your CDN hierarchy if it differs from the default
Tilesfolder. - Use Max Concurrent Requests and Caching Settings to tune bandwidth and memory usage for the CDN environment.
TileLoader automatically rebuilds its effective base path when you change these fields or when a location provides its own tilesFolder value, so no extra scripting is required beyond entering the correct URL.
Validation Tips
- Enable
TileLoader.logCacheStatsduring testing to monitor cache churn. - Watch the Unity console for the normalized path reported in
UpdateEffectiveTileBasePathlogs when running in the Editor. - If tiles do not appear, check the browser network tab (in a WebGL build) or use a proxy like Fiddler/Charles to verify the composed URL
https://cdn.example.com/panorama_tiles/<location-folder>/<level>/<row>/<col>.jpg(or .ktx2) is reachable.