I created a room. Now, how do I get its roomid?

0 votes
In my game user can create a room and then share the roomid with friends for them being able to join the room. Once a room is created I want to display the roomid so that the user can share it. There is NO callback that returns the roomid. How do I get it?
asked Sep 1, 2019 in Announcements by Ishan Gupta (10 points)

1 Answer

0 votes
Hi Ishan,

Greetings!!!

We have forwarded your query to our team we will get back to you as soon as possible.

Regards,

Priyanka Singh

App42 Team
answered Sep 3, 2019 by anonymous
When I use the following function,

public void onCreateRoomDone(RoomEvent eventObj)
{
            string roomID = eventObj.getData().getId();
}

I get a NullReferenceException.
Also, when using this statement, the connection state is always 1. I check it abundantly.
But when I remove this statement the connection state goes to 0 but what's the point of it then?


When I use the following code:

public void onCreateRoomDone(RoomEvent eventObj)
{
            //Statement doesn't give any error or exception.
            RoomData rd = eventObj.getData();

            //Prints 'com.shephertz.app42.gaming.multiplayer.client.events.RoomData' ???
            Debug.Log(rd);

            //GIVES NullReferenceException
            string roomID = rd.getId();
}
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...