- Home /
RPC function Unity
Hello! I'm trying to create a multiplayer room. I have an option CreateRoom and JoinRoom. Prefabs that are instantiated during runtime should be shown when joining the room. I read that an RPC function is needed for this. But i don't really know how this works...
Answer by jmgek · Mar 19 at 04:32 PM
Think of a RPC like a networked function (it can be called ON the network and trigger the listeners). You don't need to grab your component of your pv
every frame, and you're triggering All
the users with RPCTargets.All with your "SelectOption" (SelectOption is your function, RPCTarget is the flag)
If you have a reference to something you don't need to reference it again.
What you need to look into more is the RPCTargets.All flag, as that's what's invoking your functions on the players.
Your answer
Follow this Question
Related Questions
Network Instantiate PlayerPrefab Problem 2 Answers
Multiple timers on server as objects or prefabs? 0 Answers
How do I re-instantiate original prefab after a game object inside has been destroyed? 2 Answers
[C#] How can I destroy instantiated prefabs when many are created with the same name? 2 Answers
Updating a variable on a script in an instanced object 1 Answer