Open amaz-e opened 1 year ago
To avoid networking every bullets Gameobject -> [Client] Shoot() ->[Command] CmdShoot() -> RpcShoot()
[ClientRpc(includeOwner = false)] void RpcShoot() { DoShoot(); }
// runs on both server and client, doing different things void DoShoot() { if (isServer) // Carry a physics/scritped bullet
if (isClient) // Carry a visual bullet
}
To avoid networking every bullets Gameobject -> [Client] Shoot() ->[Command] CmdShoot() -> RpcShoot()
[ClientRpc(includeOwner = false)] void RpcShoot() { DoShoot(); }
// runs on both server and client, doing different things void DoShoot() { if (isServer) // Carry a physics/scritped bullet
}