Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Rabbel84 · Jul 07, 2013 at 01:25 AM · animationanimationsanimation.play

Animation won't play EVERY time it is called

I got a running game with the player running automatically and the only inputs for controls is shooting and jumping, they both work. The animation for shooting does work when I want it to, SOMETIMES. I don't know why, but it will occasionally not play the shooting animation when it's supposed to, sometimes it does that several times in a row and then will work again.

Here is the code that calls the animation for shooting

 void zombieShoot()
     {
         if(Input.GetMouseButtonDown(0))
             {
                 Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                 RaycastHit hit;
                 
                 if(Physics.Raycast(ray, out hit))
                 {
                     if(hit.transform.tag == "zombieObstacle")
                     {
                         
                         dude.animation.Play("shoot");
                         gunFlash.Play();
                         audio.clip = gunShots[Random.Range(0,2)];
                         audio.Play();
                         
                         
                     }
                 }
             }
     }
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Rabbel84 · Jul 25, 2013 at 11:33 PM 0
Share

any help would be appreciated. I just came back to this project after being away a while.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by 87morpheus · Jul 07, 2013 at 09:24 AM

Somewhere in your script, do you have something like gunTimer --?

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Rabbel84 · Jul 08, 2013 at 12:45 AM 0
Share

Now that you mention it, that may have been the issue. I was using it to prevent from being able to shoot too fast, but now I have it set to only shoot when the zombie is clicked on...so I got rid of the timer.

avatar image Rabbel84 · Jul 25, 2013 at 11:20 PM 0
Share

I removed gunTimer from the script, no longer needed. Still same issue though

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Animation2D help! 1 Answer

Do animation rotations refuse to accept negative values? 2 Answers

Animation not looping 1 Answer

Create animation transitions via script. 0 Answers

The 'correct' way to deal with animations in a grid-based game? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges