WebGL with Unity Cloud Saving

Crystal Save – WebGL Guide

Crystal Save fully supports Unity WebGL builds, with multiple options for local and cloud persistence. This guide explains the supported backends, browser limitations, and current known issues.


1. Local Saving in WebGL

  • By default, Crystal Save writes to the browser’s IndexedDB filesystem (/idbfs/<project>).

  • You can override the folder using SaveSettings → PersistentPathOptions if you host multiple WebGL games on the same domain.

  • Data is stored as binary (.sav) or JSON, depending on your chosen Save Method.


2. Cloud Backends

Crystal Save supports these backends for WebGL:

  • Unity Cloud Save ✅ (recommended)

    • Uses the Data API instead of Files API (Unity’s File API is unreliable in WebGL).

    • Supports:

      • Binary or JSON saves

      • Uploading metadata

      • Uploading screenshots (JPEG, max 512×512, ~50% quality).

    • Limitation: Data API payloads must stay below ~5 MB. Crystal Save’s built-in compression ensures most saves fit easily.

  • Supabase (Beta) ⚠️

    • Pure REST integration.

    • Some features are not fully stable; bug fixes are planned in later releases.

  • Firebase (Beta) ⚠️

    • Similar to Supabase; metadata and screenshot support are limited.

  • MySQL (via Web API)

    • Supported if your database is accessible through an HTTPS API.

    • Due to CORS restrictions, you must either:

      • Host the API on the same domain as your WebGL build, or

      • Use HTTPS with proper CORS headers enabled.


3. Browser Compatibility

  • Chrome-based browsers (Chrome, Edge, Brave, Opera) are recommended.

  • Mozilla browsers (Firefox) may show reduced performance because Unity WebGL uses compatibility workarounds.


4. Encryption in WebGL

  • Crystal Save supports AES-256-GCM encryption even in WebGL builds.

  • Implemented using the Bouncy Castle cryptography library, which provides military-grade encryption.

  • Note: Encryption may slightly increase CPU usage in browsers during save and load operations


5. Practical Limits in WebGL + Cloud

  • Screenshots: JPG only, max 512×512 pixels, ~50% quality.

  • File size: Unity Cloud Save (Data API) limited to ~5 MB per record.

  • Compression: Always enable in SaveSettings to reduce file size and stay under limits.

  • Slot Sync: Crystal Save merges remote and local slots; if remote saves are deleted, local stale data is cleaned up automatically

Last updated