SDKs

Unity

Load Veresk configs in a Unity game with caching on the device.

Repository: VereskUnitySdk. Requires Unity 2022.3 or newer.

Install

In Unity open Package Manager → Add package from git URL and enter:

https://github.com/SaleyIlya/VereskUnitySdk.git#1.0.0

Connect

The Integration page generates this snippet for your project. The SDK builds URLs as BaseUrl/ProjectId/…, so the CDN URL of the project is split at its last segment: everything before it is BaseUrl, the last segment is ProjectId.

using VereskSDK;
using VereskSDK.Models;

VereskAPI.Init(new VereskSetupData
{
    BaseUrl = "<CDN base URL>",
    ProjectId = "<project id>",
    Version = "default",
    Consumer = "game-client",
});

// File name -> raw content of every config of the consumer.
// Throws when the CDN is unreachable and nothing is cached yet.
Dictionary<string, string> configs = await VereskAPI.LoadConfigs();

Read a config

using Newtonsoft.Json; // ships with the SDK

var settings = JsonConvert.DeserializeObject<Settings>(configs["settings.json"]);

Notes

  • Configs are cached on the device and served from the cache when the CDN is unreachable.
  • The SDK does not decrypt files. Encrypted files arrive as ciphertext, so do not use encryption for configs a Unity client must read.
  • Version and consumer are addressed by name.