- Home /
Reload Animation
I'm trying to make my reload animation play when i press r here is what i have.`var isM16 = false;
var isM16Clip = false; var isLeftHand = false; var m16Reload : AnimationClip; var m16RelaodClip : AnimationClip; var LeftHandReloadM16 : AnimationClip;
function Start(){ if(isM16 == true) { Input.GetButtonDown("r"); Animation.Play("m16Reload");
function Update(){ if(isM16Clip == true) { Input.GetButtonDown("r"); Animation.Play("m16ReloadClip");
function Update(){ if(isLeftHand== true) { Input.GetButtonDown("r"); Animation.Play("LeftHandM16Reload");
} }`
a little easier way to do that then using multiple scripts to access one animation and using true and false is to add a reload function in your shoot script like this:
function Update(){ if(Input.GetButtonDown("r");{ Reload; } } function Reload(){ GameObject.Find("m16").animation.Play("m16Reload"); GameObject.Find("m16Clip").animation.Play("m16ReloadClip"); GameObject.Find("LeftHand").animation.Play("LeftHand$$anonymous$$16Reload); }
only bad thing is that it has to find these animations but I'm sure would run smoother than turning it true or false.
Your answer
![](https://koobas.hobune.stream/wayback/20220613015128im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
script for animation play 1 Answer
Reload animation.... magazine hiding 0 Answers
Reload FPS Animation Not Playing (Javascript) 1 Answer
Switch Weapon Script Not taking effect HELP!! 2 Answers
Play animation serially imported from Maya to Unity 1 Answer