// Use this for initialization void Start() { // UnityThreadHelper.EnsureHelperForce (); matchApi = BacktoryRealtimeUnityApi.GetMatchApi(MainScript.LastFoundedGameId); matchApi.SetRealtimeSdkListener(this); matchApi.SetMatchListener(this); addClickListeners(); // TODO use better name like JoinAndStart or ConnectAndJoin BacktoryResponse <ConnectResponse> response = matchApi.ConnectAndJoin(); if (response.Successful) { writeLine("---connected: " + response.Body.Username + ":" + response.Body.UserId); } else { writeLine("---connect failed with code: " + response.Code + " and message: " + response.Message); } }