Sending and receiving variables trough network?

Hi there, I’ve found a few similiar questions, but none of them reflect exactly what I need to know.

Description:

I have 2 gameObjects, “player” and “other”, both have a networkView. The “other” object has a String variable called “othervariable”.

Problem:

I want do be able to change the “othervariable” in the “other” object trough the network.

What I’ve tried already:

I tried to call RPC functions, but it didn’t work properly, yet. I can change the variables, but I can’t receive their values.

I tried OnSerializeNetworkView, I’ve read the reference but I still don’t understand how it could be useful. After creating the function, I tried this in the “player” script:

  1. other.networkView.othervariable = newvalue;

Is it wrong?

RPC functions work perfectly for what you are talking about. You can send more than one var via RPC. It does not send over the varible name but it sends over its value.

var hotdogs : int = 10;

if you send hotdogs, you are sending the number 10. on the other side you interet it.

var hotdogs : int = 0;
@RPC
function Howmanyhotdogs( incomingHotDogs : int){
hotdogs = incomingHotDogs;
}

now hotdogs is 10.

you can pass multiple things like

@RPC
function HowmanyHotDogs(incLocation : Vector3, IncAmount : int, incTraveSpeed : float){

then you can use these var locally.

Here is some more info on how to use it.
http://unity3d.com/support/documentation/Components/net-RPCDetails.html

what your saying works for int, float, but not string. im having the same problem i think its a bug in unity