mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
MirrorTests: CreateNetworkedAndSpawnPlayer without <T> helper function
This commit is contained in:
parent
881d90f539
commit
87478178e9
@ -223,6 +223,23 @@ protected void CreateNetworkedAndSpawn<T, U, V>(out GameObject go, out NetworkId
|
||||
}
|
||||
}
|
||||
|
||||
// create GameObject + NetworkIdentity + NetworkBehaviour & SPAWN PLAYER.
|
||||
// often times, we really need a player object for the client to receive
|
||||
// certain messages.
|
||||
protected void CreateNetworkedAndSpawnPlayer(out GameObject go, out NetworkIdentity identity, NetworkConnection ownerConnection)
|
||||
{
|
||||
// server & client need to be active before spawning
|
||||
Debug.Assert(NetworkClient.active, "NetworkClient needs to be active before spawning.");
|
||||
Debug.Assert(NetworkServer.active, "NetworkServer needs to be active before spawning.");
|
||||
|
||||
// create a networked object
|
||||
CreateNetworked(out go, out identity);
|
||||
|
||||
// add as player & process spawn message on client.
|
||||
NetworkServer.AddPlayerForConnection(ownerConnection, go);
|
||||
ProcessMessages();
|
||||
}
|
||||
|
||||
// create GameObject + NetworkIdentity + NetworkBehaviour & SPAWN PLAYER.
|
||||
// often times, we really need a player object for the client to receive
|
||||
// certain messages.
|
||||
|
Loading…
Reference in New Issue
Block a user