An object is supposed to change its color when clicked in game. The debug shows the click is detected by OnMouseDown and the function SetColor is successfully called. But the material isnt changing in either client or server view. Debugging newColor in the SetColor function also shows it has been passed correctly. Can’t figure this out:
#pragma strict
var newCol : Vector3 = Vector3(0,0,1);
function OnMouseDown () {
Debug.Log("Clicked");
networkView.RPC("SetColor", RPCMode.AllBuffered , newCol);
}
@RPC
function SetColor (newColor : Vector3) {
renderer.material.color = Color(newColor.x,newColor.y,newColor.z,1);
Debug.Log("Set Color is called");
So, not really an RPC problem? (since it doesn't change even your own color.) Maybe double-check it works as a non-RPC. Try printing
– Owen-ReynoldsnewColorin SetColor. It is using the wrong renderer (notcow1.renderer...?) Try with the script on a simple cube.