- Home /
Question by
DutchWarfare12 · Aug 02, 2012 at 06:35 PM ·
networkingmultiplayerchangerpc
RPC activate object
hi i got a question i want to activate my fps weapon and deactivate all other weapons i can deactivate it for my self but the other network players can see all my weapons i think i can fix this by using rpc but i dont know hot do you guys know somthing
here some part of my code ( i know its wrong just somthing i tryed)
@RPC
function W1 (){
networkView.RPC ("W1", RPCMode.All, PrimarySlot.gameObject.SetActiveRecursively(true);
networkView.RPC ("W1", RPCMode.All, SecondarySlot.gameObject.SetActiveRecursively(false);
networkView.RPC ("W1", RPCMode.All, ThirdSlot.gameObject.SetActiveRecursively(false);
yield WaitForSeconds(WaitTime);
PrimarySelected = true;
SecondarySelected = false;
ThirdSelected = false;
WA1.animation.CrossFade(Gun1Up);
}
Comment
ok i placed the activate stuff ( PrimarySlot.gameObject.SetActiveRecursively(true); )
in an new function
and the ware i press button (1) then i call an RPC
networkView.RPC ("new function", RPC$$anonymous$$ode.All)
then it works
( srry for my english )
Your answer
![](https://koobas.hobune.stream/wayback/20220613075102im_/https://answers.unity.com/themes/thub/images/avi.jpg)