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?
asked Sep 30 '11 at 07:26 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:
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.
answered Sep 30 '11 at 09:07 PM