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 alex0091845 · Nov 18, 2012 at 10:34 PM · animationgun

Play Specific Animations of an Object

Hi everybody, I've been messing with Unity a little but I'm still new to it. I'm trying to make this gun game where I made a modeled and animated machine pistol that I want it to play the shooting animation when mouse is clicked. I have it set to that part, but how do I play the animation when it needs to reload? I don't want it to intersect with the shooting animation. I also, BTW, have the animation split up so that it will work. The shooting animation is basically named "shoot", and the reloading is "reload". So... how do I do it? Anyone help me please?

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by whydoidoit · Nov 18, 2012 at 10:52 PM

You've got lots of choices :)

You can animation.CrossFade("reload") which will blend one into the other. Then cross fade them back.

You can stop the shoot animation and just play reload: animation.Play("reload")

You can put them on different layers (so reload is higher than shoot) then animation.Play("reload") will take over from the shooting and then go back when it stops (presuming its set to Once).

You can get the individual animation states by doing animation["youranim"] and set the weight, the speed and whether it is enabled for each animation separately.

Comment
Add comment · Show 3 · 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 alex0091845 · Nov 18, 2012 at 11:02 PM 0
Share

Ok, thanks, I'll try :)

avatar image whydoidoit · Nov 18, 2012 at 11:04 PM 0
Share

Takes some kicking does the animation system - powerful though.

avatar image alex0091845 · Jan 22, 2013 at 05:28 AM 0
Share

Yes, I've solved the problem -- it turns out that I had two variables -- shoot and reload. When shoot is 0, reload = 1 which means true. Then you can't shoot at that time. Vice versa for reload. Thanks for the answer and sorry I've not updated for a long time~ :)

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

10 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

Related Questions

Unity animation is off please help 0 Answers

3rd person gta like weapon problem?? 0 Answers

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Animation On Mouse Click 1 Answer

Animation on gun sometimes skips? 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