I create channel by this: TNManager.JoinChannel(Random.Range(10000, 99999), "", false, 8, "", false);
other connect here through channelList;
afterConnect to channel everybody create his lobbyPlayer(just UI with TNobject for sync RFC):
TNManager.Instantiate(mChannelID, "CreateLobbyPlayer", "LobbyPlayer", false, TNManager.player.id, TNManager.player.name);
[RCC]
static GameObject CreateLobbyPlayer(GameObject prefab, int id, string pName)
{
GameObject go = prefab.Instantiate();
LobbyPlayer obj = go.GetComponent<LobbyPlayer>();
obj.Set(pName);
if (id == TNManager.player.id)
{
localLobbyPlayer = obj;
}
return go;
}
and then playerHost start round for everyOne, by send RFC from "localLobbyPlayer.TNobject"
TNManager.LoadLevel("sceneOne");
on loaded new scene everyody spawn his own gamePlayers:
TNManager.Instantiate("CreatePlayer", "playerPrefabObject", false, spawn.position, spawn.rotation, TNManager.player.id);
[RCC]
static GameObject CreatePlayer(GameObject go, Vector3 pos, Quaternion rot, int id)
{
go = Instantiate(go, pos, rot) as GameObject;
if (TNManager.player.id == id)
{
localPlayer = go.GetComponent<PlayerController>();
}
AllPlayers.Add(go.GetComponent<TNObject>().ownerID, go.GetComponent<PlayerController>());
return go;
}
well, after round I goOut in new scene "LobbyScene" by this:
TNManager.LoadLevel("LobbyScene");
all network objects have destoyed - we dont have lobbyPlayer(because "LoadLevel") go again create it for everybody,
thats correctly? my way is wrong for making lobby system?