- Home /
Array of NetworkViewID passing in a RPC
Hey guys, I know that i can just send some types of variables in a RPC, and to pass an array of strings or numbers, i can easily create a string with some separator character and split then on the client, but my situation is different, i need to pass an array of NetworkViewIDs in a RPC. I know i can send networkViewIDs but they need to be seted in script, i need it dynamic, and i cant read it as string because it has some properties that cant be shown.
Can anyone help me with this?
Thanks.
Answer by Bunny83 · Sep 30, 2011 at 09:07 PM
NetworkViewID is a struct that contains internally 3 private ints. However the only way to access those values directly would be using Reflection but i wouldn't recommend that!
The only two legit ways i can see is to:
send multiple RPCs each one with a different ViewID
use OnSerializeNetworkView to manually transfer the data you need.
The second method is probably a bit faster but it's a bit complicated to achieve. I guess you want send the IDs to new players as initialization? As a one-time-events it doesn't really matter if you send them seperated. If you really have a lot of IDs to sync you should even stretch the initialization over multiple frames to reduce network peaks using a coroutine.
yea, what i did it's send many separated RPCs, because they are just when a new player enter the match. Thanks
Your answer
Follow this Question
Related Questions
Sending info to/from different networkViews 1 Answer
How can I send a mouse click to a server using an RPC? 0 Answers
Does the position change need state synchronization? 2 Answers
Multiplayer Game Question 1 Answer
Is server the sender of RPC? 0 Answers