local variable's owner
Options
I have 2 network players in a game. One player save his speed into a local variable and try to get the speed value later.
But the variable gives out the other player's (on other player's device). My code is simple like this.
....
private int speed;
...
speed = BasicData.speed; (player a 's current speed. It is set to 3.5f)
...
BasicData.speed = speed; (I expected player a's saved speed(3.5f), but it gives zero which is player b's)
...
Player a does not move anymore on player b's device. Of course the game is ok on player a's device.
Sorry for my English. I hope you understand what I'm trying to say.
Thanks in advance for any help.
But the variable gives out the other player's (on other player's device). My code is simple like this.
....
private int speed;
...
speed = BasicData.speed; (player a 's current speed. It is set to 3.5f)
...
BasicData.speed = speed; (I expected player a's saved speed(3.5f), but it gives zero which is player b's)
...
Player a does not move anymore on player b's device. Of course the game is ok on player a's device.
Sorry for my English. I hope you understand what I'm trying to say.
Thanks in advance for any help.
0
Comments
-
I think I got the answer. Variable speed should be public static.0