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);
}
}