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 FinalChange_ · Feb 24, 2014 at 05:58 PM · animation

Animation doesn't play when calling it with a script!!

My Animation doesn't play when I'm calling it with a script!? I have animation component with a clip called Shot on my object. What's wrong, i have tried everything. Here's my script:

 function Update () 
 {
     if(Input.GetMouseButtonDown(0))
     {
         animation.Play("Shot");
     }
 }
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by lorainiscool · Feb 24, 2014 at 06:19 PM

Try changing the line to : Animation.Play("Shot"); [Unity is known to have issues with capitalisation]

Comment
Add comment · Show 1 · 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 FinalChange_ · Feb 24, 2014 at 06:42 PM 0
Share

That did'n work :/

avatar image
0

Answer by screenname_taken · Feb 24, 2014 at 08:32 PM

Are you using an animator component or the older animation component? If you are using the older component or you are getting a warning that the animation needs to be set as legacy, try to set the animation clip as "legacy" if you imported it from a 3D package. If you made it in unity, click the animation clip file in the Project panel, then click the drop down icon next to the lock icon on the top right of the inspector panel, and from the drop down menu select "debug". Then in the box for "animation type" write 1. (That will force it into legacy.)

Also, did you double check in the editor, just to see if the clip is actually connected to the object? I get that sometimes.

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 FinalChange_ · Feb 25, 2014 at 08:17 AM 0
Share

$$anonymous$$y animation is 2d sprite animation, i made it in unity, i am using the animation component and i have set my animation clip as "legacy" because it gave me error of that. But still it doesn't work!! And yes i double checked that.

avatar image screenname_taken · Feb 25, 2014 at 09:58 AM 0
Share

Just a wild stab in the dark here. If there isn't any kind of debug message/ error about the animation, have you tried setting the animation's speed to 1 with animation["Shot"].speed=1; ? Normally it shouldn't be anything less than 1 if it's set to play automatically... I'm sorry i know you are probably frustrated by now but it's the only other thing i can think about.

EDIT: i just found out in a different thread that the 2D animations were built to be used with the animator component, not the animation one if you are using the dope sheet.

avatar image FinalChange_ · Feb 25, 2014 at 10:21 AM 0
Share

Thanx for answer. $$anonymous$$y animations speed is 1... but I'll try to use animator ins$$anonymous$$d. :D

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

21 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

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

Mecanim animation and scripting problems 0 Answers

Animation interference problem 1 Answer

Fireflies... 1 Answer

Animation Problems 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