AbstractSessionConnected Event |
Namespace: SoftGear.Strix.Unity.Runtime.Session
public event StrixNetworkConnectEventHandler Connected
public void ConnectedEventSample(string applicationId, string host, string playerName) { StrixNetwork.instance.roomSession.Connected += args => { Debug.Log("Room session connection has been established with the following host: " + args.session.host + ":" + args.session.port ); }; StrixNetwork.instance.applicationId = applicationId; StrixNetwork.instance.ConnectMasterServer( host: host, connectEventHandler: _ => { StrixNetwork.instance.JoinRandomRoom( playerName, handler: joinRoomResult => { }, failureHandler: joinRoomError => { StrixNetwork.instance.CreateRoom( new RoomProperties { name = "New Room", capacity = 4, }, new RoomMemberProperties { name = playerName }, createRoomResult => { }, createRoomError => Debug.LogError( "Could not join nor create a room." + " Reasons: " + joinRoomError.cause + "; " + createRoomError.cause ) ); }); }, errorEventHandler: connectError => Debug.LogError("Connection failed. Reason: " + connectError.cause) ); }