Hi, I’ve hit a snag in my code.
I’m making a multiplayer FPS game and currently working on an animation controller script that is attached to the instantiated player prefab. I havent worked with networking before. I want the player that moves, to broadcast his current animation so that everyone can see it. However it seems like it applies the animation to all instantiated players with the script attached.
Thanks in advance for taking a look.
it looks like this:
function Update()
{
if(networkView.isMine){
/* A lot of input detectors here and currentAnimation declaration for every combination of input */
currentAnimation = "StrafeRunRightAim";
}
if(currentAnimation != '')
{
PlayAnimation(currentAnimation);
}
}
@RPC
function PlayAnimation(a){animation.Play(a);}
Also on a sidenote I did start working on enums but im not sure how to use them for this, if you guys can recommend a better way of broadcasting animations i’m definetly willing to look into it and try it.