Add here questions or corrections regarding the book:
Unity Multiplayer Games
Build engaging, fully functional, multiplayer games with
Unity engine
from: Alan R. Stagner
Excellent book and is in my need to have list.
My question is :
At page 50, where i need to add “ConnectToGame” code to and how?
If i make a new empty game object and add this code, it gives me error
“Assets/Scripts/Network/PongGameConetion/ConnectToGame.cs(44,17): error CS0103: The name `NetworkLevelLoader’ does not exist in the current context”
Corrections:
At page 31: in the file code 23280T_01_10 at line number 19 need to add " ; " at the end of the line.
using UnityEngine;
using System.Collections;
using PlayerIOClient;
public class ConnectToPlayerIO : MonoBehaviour
{
public bool UseDevServer = true;
Client client;
void Start()
{
PlayerIO.UnityInit( this );
PlayerIO.Connect( "chat-9vc2ka3twucxfbshbezc7q", "public", "Guest", 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 );
} );
}
void GetRoomList()
{
// get a list of all rooms with the given room type and search criteria (null = all rooms)
client.Multiplayer.ListRooms( "SomeRoomType", null, 0, 0,
delegate( RoomInfo[] rooms )
{
Debug.Log( "Found rooms: " + rooms.Length );
},
delegate( PlayerIOError error )
{
Debug.Log( error.Message );
} );
}
}
I have a question about this book.
On page 130, the author creates a script to use Player.IO. The problem is that when it plays, I get this problem:
Assets/Scripts/ConnectToPlayerIO.cs(17,34): error CS1660: Cannot convert anonymous method' to non-delegate type string[ ]’
This refers to delegate (Client c) after the Player.IO.Connect.