This repository was archived by the owner on Aug 15, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 307
Sending RPC to a Single Player
Tzian edited this page May 23, 2019
·
3 revisions
During your development process you may find that you have to send an RPC to a single player and nobody else. This is especially useful to target players that are just connecting to the server to send them needed data that is not buffered already.
// targetPlayer is a NetworkingPlayer refence we got from the NetWorker::Players list or anywhere else
// args is an object array
networkObject.SendRpc(targetPlayer, RPC_RPC_NAME, args);// Somewhere in your code
if (networker.IsServer)
networker.playerAccepted += PlayerAcceptedSetup;
// ...
private void PlayerAcceptedSetup(NetworkingPlayer newPlayer, NetWorker sender)
{
networkObject.SendRpc(newPlayer, RPC_RPC_NAME, args);
}This player targeting with RPCs are done on the server. Clients do not have direct access to each other since all network traffic goes through the server (which makes it authoritative. You can use Receivers.Owner to target the owning player of the network object from any client though.
Getting Started
Network Contract Wizard (NCW)
Remote Procedure Calls (RPCs)
Unity Integration
Basic Network Samples
Scene Navigation
Master Server
Netcoding Design Patterns
Troubleshooting
Miscellaneous
-
Connection Cycle Events
-
Rewinding
-
Network Logging
-
Working with Multiple Sockets
-
Modify Master and Standalone servers
-
NAT Hole Punching
-
UDP LAN Discovery
-
Offline Mode
-
Ping Pong
-
Lobby System
-
Upgrading Forge Remastered to Develop branch or different version
-
Forge Networking Classic to Remastered Migration Guide
-
Script to easily use Forge Networking from sources
-
Run Two Unity Instances with Shared Assets for Easiest Dedicated Client Workflow