mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
CreateNetworkedAndSpawn without component helper function
This commit is contained in:
parent
aff28a0c07
commit
0fdb39fa1c
@ -138,6 +138,21 @@ protected void CreateNetworked<T, U, V>(out GameObject go, out NetworkIdentity i
|
||||
instantiated.Add(go);
|
||||
}
|
||||
|
||||
// create GameObject + NetworkIdentity + NetworkBehaviour & SPAWN
|
||||
// => ownerConnection can be NetworkServer.localConnection if needed.
|
||||
protected void CreateNetworkedAndSpawn(out GameObject go, out NetworkIdentity identity, NetworkConnection ownerConnection = null)
|
||||
{
|
||||
// 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.");
|
||||
|
||||
CreateNetworked(out go, out identity);
|
||||
|
||||
// spawn
|
||||
NetworkServer.Spawn(go, ownerConnection);
|
||||
ProcessMessages();
|
||||
}
|
||||
|
||||
// create GameObject + NetworkIdentity + NetworkBehaviour & SPAWN
|
||||
// => ownerConnection can be NetworkServer.localConnection if needed.
|
||||
protected void CreateNetworkedAndSpawn<T>(out GameObject go, out NetworkIdentity identity, out T component, NetworkConnection ownerConnection = null)
|
||||
|
Loading…
Reference in New Issue
Block a user