Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.hyperx.dev/llms.txt

Use this file to discover all available pages before exploring further.

Public Storage distributes files every player may download, such as patches, images, balance JSON, and notice assets. Operators upload and replace files in Console. Clients read metadata and download files through the SDK.

Flow

  1. Upload a file from Console Public Storage.
  2. Add a tag if you need versioned variants.
  3. Check the file hash from Unity.
  4. Download only when the local file is missing or the hash changed.

Version with Tags

ExampleMeaning
Items.jsonDefault version
Items.json + tag season-1Season-specific version
Items.json + tag season-2Next season version
When tag is provided, HyperX resolves the exact version. When omitted, HyperX first looks for the untagged file, then falls back to the most recently updated version with the same filename.

Metadata

var meta = await HyperX.Core.PublicStorage.GetMeta("Items.json");
Debug.Log($"{meta.Hash} / {meta.Size} bytes");
var meta = await HyperX.Core.PublicStorage.GetMeta("Items.json", tag: "season-2");
ObjectMeta includes hash, MIME type, size, and update time.

Hash Only

string hash = await HyperX.Core.PublicStorage.GetHash("Items.json");

Download

To memory:
var progress = HyperX.Core.PublicStorage.Get("Items.json");
byte[] bytes = await progress.File;
To Unity storage:
var progress = HyperX.Core.PublicStorage.Get(
    "Items.json",
    "content/Items.json",
    tag: "season-2"
);

await progress.File;
In Unity, save paths are resolved under Application.persistentDataPath.

Hash-Based Cache

using System.IO;
using UnityEngine;

public class HyperXStorageCache : MonoBehaviour
{
    async void Start()
    {
        string fileName = "Items.json";
        string savePath = "content/Items.json";

        string remoteHash = await HyperX.Core.PublicStorage.GetHash(fileName);
        string localHash = PlayerPrefs.GetString($"HX_HASH:{fileName}");

        if (remoteHash != localHash)
        {
            var progress = HyperX.Core.PublicStorage.Get(fileName, savePath);
            await progress.File;
            PlayerPrefs.SetString($"HX_HASH:{fileName}", remoteHash);
        }

        string fullPath = Path.Combine(Application.persistentDataPath, savePath);
        string json = File.ReadAllText(fullPath);
        Debug.Log(json);
    }
}