- Home /
Multiplayer issue - players view others as themselves with same material
Here is a screen http://i285.photobucket.com/albums/ll56/Seanzzilla/screen_zps97d9d115.png
Hey can anyone tell me what is going on here? I'm using RPCs to update player's clothing when they connect to the server. But when this happens, each player views other players as themselves. What am I doing wrong???
I am not using static variables to hold player's clothing IDs, but I am getting them from player prefs. Is that what may be causing the problem?
@RPC
function UpdateAppearance(){
print(curCharacter);
var c : int = curCharacter;
head.renderer.material = Resources.Load("h/h"+PlayerPrefs.GetInt("c"+c+"head")+"c"+PlayerPrefs.GetInt("c"+c+"color"));
body.renderer.material = Resources.Load("b/b"+PlayerPrefs.GetInt("c"+c+"body"));
arm1.renderer.material = Resources.Load("a/a"+PlayerPrefs.GetInt("c"+c+"body"));
arm2.renderer.material = Resources.Load("a/a"+PlayerPrefs.GetInt("c"+c+"body"));
leg.renderer.material = Resources.Load("a/a"+PlayerPrefs.GetInt("c"+c+"body"));
}
$$anonymous$$ore information is required to answer the question. For instance, we have no idea how you are setting the material.
Answer by andysctu · Mar 08, 2016 at 08:54 AM
I had this same problem. My workaround was this:
Client sends a [Command] to server with the names of the new clothes that he wants to wear. Server then calls a [ClientRpc] to actually do the swapping of clothes, so that all clients will see the result.