help … i made an assault shield and i put photonview on it but when i start my game twice on the second screen the shield doesnt show up on the chracter but from the chracter itself i van see it.
my variables:
var uses int = 1;
var shield : GameObject;
.................................
if(Input.GetKey(KeyCode.V)&&uses=1){
shield.SetActive(true);
WaitForSeconds(10){
shield.SetActive(false);
}
}
I guess that’s because the SetActive() method only works at the local game. If you want to activate or deactivate the shield using SetActive(), you will need to call a RPC function on all the clients to activate your shield on their games too.
Like that:
var uses int = 1;
var shield : GameObject;
.................................
if(Input.GetKey(KeyCode.V)&&uses=1){
networkView.RPC("activateShield", RPCMode.AllBuffered, true);
WaitForSeconds(10){
networkView.RPC("activateShield", RPCMode.AllBuffered, false);
}
}
@RPC
function activateShield(active:bool) {
shield.SetActive(active);
}
Of course that’s a lot of ways to do that, you can also call a RPC method that controls the shield on the other clients game.
=]