void Start() { PlayerIO.UnityInit(this); PlayerIO.Connect("YourGameIDHere", "public", "YourUserIDHere", null, null, delegate(Client c) { // connected successfully client = c; Debug.Log("Connected"); // if we're using the dev server, connect to the local IP if (UseDevServer) { client.Multiplayer.DevelopmentServer = new ServerEndpoint("127.0.0.1", 8184); GetRoomList(); } }, delegate(PlayerIOError error) { // did not connect successfully Debug.Log(error.Message); }); }
public virtual void Connect(Callback <Client> onSuccess, Callback <PlayerIOError> onFail) { PlayerIO.UseSecureApiRequests = true; PlayerIO.UnityInit(this); PlayerIO.Authenticate("burst-my-heart-dyhe2gzfzukop2uttnxokw", "public", new Dictionary <string, string> { { "userId", "" }, }, null, onSuccess, onFail ); }
public virtual void Connect(Callback <Client> onSuccess, Callback <PlayerIOError> onFail) { PlayerIO.UseSecureApiRequests = true; PlayerIO.UnityInit(this); PlayerIO.Authenticate("archer-game-2bfjdlweau2y3imzhiljjq", "public", new Dictionary <string, string> { { "userId", "" }, }, null, onSuccess, onFail ); }
void Start() { PlayerIO.UnityInit(this); PlayerIO.Connect("YourGameIDHere", "public", "YourUserIDHere", null, null, delegate(Client c) { // connected successfully client = c; Debug.Log("Connected"); }, delegate(PlayerIOError error) { // did not connect successfully Debug.Log(error.Message); }); }
void Connect() { // we need some monobehavior in the scene for player.io to work, but it can be any monobehavior so we’ll just put our NetworkUtils component on it. if (GameObject.Find(“_playerIO”) == null) { GameObject go = new GameObject(“_playerIO”); go.AddComponent <NetworkUtils>(); DontDestroyOnLoad(go); PlayerIO.UnityInit(go.GetComponent <NetworkUtils>()); } PlayerIO.Connect("YourGameIDHere", "public", playerName, null, null, delegate(Client client) { Debug.Log("Connected"); // store client for later retrieval NetworkUtils.client = client; // load player object client.BigDB.LoadMyPlayerObject( delegate(DatabaseObject playerObj) { // store player object for later retrieval NetworkUtils.playerObj = playerObj; // read stats from player object botsKilled = playerObj.GetInt("Kills", 0); botsLost = playerObj.GetInt("Deaths", 0); }, delegate(PlayerIOError error) { Debug.Log("Failed loading player object: " + error.Message); }); }, delegate(PlayerIOError error) { Debug.Log("Failed to connect: " + error.Message); }); }