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:
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;
}