Unity Game SDKv0.5.1Download SDK
RUEN

Quick start

A minimal integration takes about 15 minutes: install the package, add the SDK component, and subscribe to events.

SDK v0.5: ConnectAsync() returns only after an accepted server.hello, so calling ReadyAsync() immediately afterwards is safe.

Add the SDK to the scene

Create an empty GameObject named VORIVOX SDK and add the VorivoxGameSdk component.

Create a game controller

using UnityEngine;
using Vorivox.UnityGameSdk;

public sealed class GameController : MonoBehaviour
{
    [SerializeField] private VorivoxGameSdk sdk;

    private async void Start()
    {
        sdk.SessionStarted += OnSessionStarted;
        sdk.HitReceived += OnHit;
        sdk.SessionPaused += _ => Time.timeScale = 0f;
        sdk.SessionResumed += () => Time.timeScale = 1f;

        await sdk.ConnectAsync();
        await sdk.ReadyAsync("MainScene");
    }

    private void OnSessionStarted(VorivoxSessionStart session)
    {
        StartRound(session.PlayerCount);
    }

    private void OnHit(VorivoxHit hit)
    {
        Debug.Log($"Hit: {hit.XMm}, {hit.YMm}");
    }
}

Do not start the round in Start()

Use Start() only to connect the SDK and load resources. Start timers, enemies, and gameplay after SessionStarted.

Send the result

await sdk.UpdateScoreAsync(
    new VorivoxScore(score, shots, hits, timeLeftMs));

await sdk.CompleteAsync(
    new VorivoxResult("completed", score, shots, hits,
        durationMs, sdk.Manifest.Session.PlayerCount));
Done. In mock mode you can generate hits without a physical target. Build a Linux x86_64 player for release.