December 2013
Beginner
242 pages
4h 23m
English
Once connected to a room, we have a connection that can be used to send and receive messages. Let's register event handlers for receiving messages, as well as disconnections.
First, we'll add methods to handle these events:
// called when we've disconnected from the room
void OnDisconnect( object sender, string message )
{
Debug.Log( "Disconnected from room" );
}
// called when a message is received
void OnMessage( object sender, Message e )
{
}Then we'll modify our OnGUI method to hook up these event handlers upon connection:
void OnGUI() { if( roomConnection != null ) return; if( GUILayout.Button( "Join Random", GUILayout.Width( 200f ) ) ) { client.Multiplayer.CreateJoinRoom( "$service-room$", "MyCode", true, null, null, ...Read now
Unlock full access