- Home /
Question by
Tathorpe89 · Dec 06, 2016 at 07:38 PM ·
networkingspawningclient-server
NetworkSpawn.Spawn() on all clients EXCEPT calling client
How can I tell the server to Spawn objects on all clients EXCEPT for the one I am making the NetworkServer.Spawn() call from?
I am already spawning a temporary object locally on keypress so I do not need the server to create a duplicate, just replicate to the rest of the clients and move on.
Edit: OR a way to immediately delete the server spawned clone on the client that made the call
Comment
Best Answer
Answer by Tathorpe89 · Dec 17, 2016 at 08:34 AM
void LocalSpawn()
{
//Spawn local prefab
CmdSpawn();
}
[Command]
void CmdSpawn()
{
RpcSpawn();
}
[ClientRpc]
void RpcSpawn()
{
if (isLocalPlayer) return;
//Spawn prefab to other clients
}
This worked for me.