x


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.

more ▼

asked Sep 30 '11 at 07:26 PM

leonardo_try gravatar image

leonardo_try
61 9 11 12

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Sep 30 '11 at 09:07 PM

Bunny83 gravatar image

Bunny83
45.5k 11 49 207

yea, what i did it's send many separated RPCs, because they are just when a new player enter the match. Thanks

Sep 30 '11 at 09:33 PM leonardo_try
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1363
x683
x237
x116
x35

asked: Sep 30 '11 at 07:26 PM

Seen: 1587 times

Last Updated: Sep 30 '11 at 09:33 PM