Forum Mobile Unity Android Problem

Anything specifically relating to droid or iOS development with Unity can go here.

Unity Android Problem

Postby vitsum » November 9th, 2012, 4:51 am

it works on my LG p500 (2.3.3), it connects player.io, then joins the room.
But with another device SGH-T959V(2.2.1) it connects to the player.io but, it doesn't join the room, and I don't see any errors in logcat, and if there is error entering the room, the callback fucntion should be called, but it is not called :( And in dashboard I see like 3 players are in the room, but only my lg p500 and editor sees each other, and this sgh-t959v is out of any room.
vitsum
 
Posts: 26
Joined: October 26th, 2012, 8:14 am

Re: Unity Android Problem

Postby vitsum » November 9th, 2012, 4:54 am

Code: Select all
void Start () {
      // Required to setup the Player.IO Client in Unity3D
      PlayerIOClient.PlayerIO.UnityInit(this);
      
      // create a random userid
      System.Random random = new System.Random();
      string userid = "Guest" + random.Next(0, 10000);
      
      Debug.Log("Starting");

      PlayerIOClient.PlayerIO.Connect(
         "mechwarrior-qtzac5qqouavpjgqfm98qq",   // Game id (Get your own at playerio.com. 1: Create user, 2:Goto admin pannel, 3:Create game, 4: Copy game id inside the "")
         "public",                  // The id of the connection, as given in the settings section of the admin panel. By default, a connection with id='public' is created on all games.
         userid,                     // The id of the user connecting. This can be any string you like. For instance, it might be "fb10239" if you´re building a Facebook app and the user connecting has id 10239
         null,                     // If the connection identified by the connection id only accepts authenticated requests, the auth value generated based on UserId is added here
         null,
         delegate(Client client) {
            Debug.Log("Successfully connected to Player.IO");
            _infomsg = "Successfully connected to Player.IO";

            Player.transform.name = userid;
         Player.renderer.material.color = Color.yellow;

            // Uncoment the line below to use the Development Server
            //client.Multiplayer.DevServer = new ServerEndpoint("localhost",8184);

            //Create or join the room
            client.Multiplayer.CreateJoinRoom(
               "testRoom",               //Room id. If set to null a random roomid is used
               "FightRoom",                  //The room type started on the server
               true,                        //Should the room be visible in the lobby?
               null,
               null,
               delegate(Connection connection) {
                  Debug.Log("Joined Room.");
                  _infomsg = "Joined Room.";
                  // We successfully joined a room so set up the message handler
                  _pioconnection = connection;
                  _pioconnection.OnMessage += Handlemessage;
                  _joinedroom = true;
                  Player.renderer.material.color = Color.green;
               },
               delegate(PlayerIOError error) {
                  Debug.Log("Error Joining Room: " + error.ToString());
                  _infomsg = error.ToString();
               }
            );
         },
         delegate(PlayerIOError error) {
            Debug.Log("Error connecting: " + error.ToString());
            _infomsg = error.ToString();
         }
      );
   }
vitsum
 
Posts: 26
Joined: October 26th, 2012, 8:14 am

Re: Unity Android Problem

Postby Benjaminsen » November 9th, 2012, 1:03 pm

If you test against your development server, does the user ever enter it?
Likewise, if waiting for about 5min, do you get a connection timeout?
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark


Return to Mobile



cron