Question by
gamers1432 · Oct 06, 2017 at 10:42 AM ·
networkinganimator
.nameHash and Animator.StringToHash
I'm lost on this. Trying to make it to where your character will not finish the reload and actually reload unless you are in this transition. It work before on unity 5, but now on 2017 it will not work.
Basically I have 2 layers of animations, base, then arms. Any reason why this should not work? I apologize ahead of time for the odd code layout, my code pasted weird. Fixed as best I could.
// System
public AnimatorTransitionInfo armsTransitionInfo;
// Components
private Animator animator;
void Start () {
animator = GetComponent<Animator>();
armsTransitionInfo = animator.GetAnimatorTransitionInfo(1);
}
void Update () {
if (Input.GetButtonDown("Reload")) {
if (currentGun.Reload()) {
animator.SetTrigger("Reload");
reloading = true;
}
}
}
if (reloading) {
if (armsTransitionInfo.nameHash == Animator.StringToHash("Arms.Reload -> Arms.Weapon Hold")) {
currentGun.FinishReload ();
reloading = false'
}
}
Comment
I know it's been a long time but have you found a fix for this?