I ran into someproblems sharing the material colour via network. This is the code I’m using to change the colour for my character:
The script is attached to the player object.
var redValue : float = 0.5;
var greenValue : float = 0.5;
var blueValue : float = 0.5;
var playerAppearence : GameObject; // The skinned mesh of my player that has 2 materials. "trousers" is the one I like to change the colour from. This game Object is also Nested in the player object.
var trousers : material
function Start(){
var newColour : Vector3 = Vector3(redValue,blueValue,greenValue);
networkView.RPC("myColour",RPCMode.AllBuffered, newColour);
}
function Update(){
}
@RPC
function myColour(myPlayerColor : Vector3){
if(networkView.isMine){
playerAppearence.gameObject.GetComponent(Renderer).materials[trousers].color = Color(myPlayerColor.x,myPlayerColor.y,myPlayerColor.z,1);
}
}
The error I get is: InvalidCastException: Cannot cast from source type to destination type.
Furthermore ALL other players either on the client or on the server have the same colour instead of only sending their own colour to every other player
Can you help me tackle the issue ?
Help is much appreciated!
I don’t know why it works I basically played around with the code … a lot! So if anyone would like to elaborate on this for the greater community I would be very greatful.
I am facing same problem. i want to make a video conference using webcam i can capture my video through webcam but when i want to send this video
to client through network i am not able to do it .i am sending it through RPC but i was not able to make it can any u help me please.and also how to
make live stream of it. can u please post the code.