Esempio n. 1
0
    void Start()
    {
        if (accessToken.Length == 0 || gameApiKey.Length == 0)
        {
            Debug.LogWarning("Arbiter Error: Missing Access Token or Game Api Key in the Arbiter Prefab inpesctor settings.");
        }

        _accessToken = accessToken;
        _gameApiKey  = gameApiKey;

        var arbiters = FindObjectsOfType(typeof(Arbiter));

        if (arbiters.Length > 1)
        {
            Destroy(gameObject);
            return;
        }
        DontDestroyOnLoad(gameObject);


        GameObject abGO = new GameObject("ArbiterBinding");

        abGO.AddComponent <ArbiterBinding>();
        GameObject.DontDestroyOnLoad(abGO);

        wallet = null;
        user   = null;

        ErrorHandler initializeErrorHandler = (errors) => {
            Debug.LogError("Cannot initialize Arbiter. Resolve errors below:");
            errors.ForEach(e => Debug.LogError(e));
        };

        ArbiterBinding.Init(_gameApiKey, _accessToken, InitializeSuccess, initializeErrorHandler);
    }