Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
1
Question by FancyYetiStudios · Sep 29, 2017 at 11:27 PM · scripting problemerror message

I Need Help With My Script

Hey I am making a horror game and I need this hammer to swing. I have this script and fixed a lot of problems with it. I get an error that says the animation state could not be played because it couldn't be found! Here is the script.

 var animation_bool : boolean ;
 
        function Update()
 {
 
     if (animation_bool == true)
     {
         GetComponent.<Animation>().Play("HammerHit");
 
     }
 
 
     if (Input.GetMouseButtonDown(0))
     {
         animation_bool = true;
 
     }
 
 }

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
Best Answer

Answer by AshwinTheGammer · Oct 01, 2017 at 04:15 AM

select your 3d model of hammer(default) after that You have to mark your animations as Legacy to use them with the old animation system. Click on your animation in the project view, now in the inspector there is a drop down where you can you select legacy. Hit apply and it should work. here are images : Select rig > animation type and select legacy alt text

alt text

else use animator controller.


capture.png (4.7 kB)
capture.png (20.9 kB)
Comment
Add comment · Show 7 · 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 FancyYetiStudios · Oct 01, 2017 at 02:04 PM 0
Share

I tried both scripts I get the same error. I do not know why. Have you tested out the script?

avatar image FancyYetiStudios · Oct 01, 2017 at 04:48 PM 0
Share

Isn't that the full code... I just need a script so when you right clicked it would play the animation please.

avatar image AshwinTheGammer FancyYetiStudios · Oct 02, 2017 at 02:21 AM 0
Share

i have edited my previous answer check that i am absolutely sure that it will solve u r problem and don`t forget to mark this answers as accept.

avatar image FancyYetiStudios AshwinTheGammer · Oct 02, 2017 at 10:04 PM 0
Share

Ok it worked! But the animation keeps repeating. I want it to stop after the whole animation is played also thank you for your help.

Show more comments

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

120 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 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 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 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 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 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

I get error CS0119 and I don't know why? 1 Answer

Failed to parse configuration for gameId: xxxxxx System.Threading._ThreadPoolWaitCallback:PerformWaitCallback() 3 Answers

Need help fixing error (NullReferenceException: Object reference not set to an instance of an object) 1 Answer

Error with AI going to Waypoints,Issues with AI tracking waypoints 0 Answers

The script I copied from the Summer 2020 Week 1 Tutorial, not working for me... 0 Answers


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