So I’m trying to access my object tagged “Player” animations in the script that is on his gun, so I did this(I’m slimming it down just to ask about the important parts):
function Update(){
var player = GameObject.FindWithTag("Player");
player.animation.Play("Shoot");
}
This works fine, but I want to change the animation’s WrapMode to once, so I need to find the animation in Start(), before Update().
But, if I create the “var player” in Start(), Update() can’t use that variable. Should I create it twice?
Or can I create it outside of all the functions at the top as a private variable?