The animation state GunShot could not be played because it couldn't be found! Please attach an animation clip with the name 'GunShot' or call this function only for existing animations.
Hi am having an issue, I am making a first person shooter type game, and once i enter the script function Update () { if(Input.GetButtonDown("Fire1")) { var gunsound : AudioSource = GetComponent.(); gunsound.Play(); GetComponent.().Play("GunShot"); } }
everything works when i hit play as far as walking goes, but when i shoot my gun - i get the above error and it automatically play and pause at the same time - how do i correct this issue
thanks in advance
Answer by ZeroSumGames · Nov 22, 2016 at 12:18 AM
What you want to do is read up a bit about mecanim. Don't use the system you are using for animations. Definitely use mecanim. If I were you I would back up and do some mecanim tutorials before trying to continue.
Answer by vespa39 · Nov 22, 2016 at 12:34 AM
Thank for answering, I am not very good with Mecanim - but i guess i could try it again. was making this game for a school project. but when errors like this start i get stuck and not sure what i did wrong. -
Once you figure mecanim out it is super super easy to animate things
Your answer