Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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
0
Question by Vid-Maddness · Jan 01, 2016 at 10:15 PM · animationjavascripterrorstate

"Animation state could not be played because it was not found"

I have a java script that is supposed to make a gameobject appear and play an animation when you collide with a trigger, but i always get the error "Animation state could not be played because it was not found"

here is my script:

 var monster : GameObject;
 var monster2 : GameObject;
 var playerTag = "Player";
 
 function OnTriggerEnter (col : Collider) {
     if(col.tag == playerTag){
         monster.GetComponent.<SkinnedMeshRenderer>().enabled = true;
         GameObject.Find("ghoulprefab").GetComponent.<Animation>().Play("surface");
         yield WaitForSeconds(2.16);
         GameObject.Find("ghoulprefab").GetComponent(EnemyAi).enabled = true;
         GameObject.Find("ghoulprefab").GetComponent(EnemyHealth).enabled = true;
         GameObject.Find("ghoulprefab").GetComponent(Animator).enabled = true;
     }
 }


How can this be fixed??

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by arbazgillani · May 18, 2016 at 02:23 PM

Animation component is not attached to the gameobject. Please attach it ur problem would be sorted.

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

Answer by Ego65 · Oct 06, 2016 at 05:47 PM

I had the same prob because i did add a animation component !
But that is part of the old legacy anim system. Just add an Animator component to your game object. And in your script attached to it make :

         public Animator AvaAnimation;  // or however you want to call it
             public bool reached = false;  
             private Vector3 Dist;
     void Awake() // my simple example
     {
             AvaAnimation = GetComponent<Animator>();
             AvaAnimation.enabled = false;
     }

     void Update () 
     {
         
             if(thisgameobj.activeSelf)
             {
                     Dist.z = targetpos.z - thistransform.transform.position.z;
                     if(Dist.z <= 0.1f) 
                     {
                             reached = true;
                     }

                     if(!reached)
                     {
                             MoveForward(); // animation wont play
                     }
                     else
                     {
                             if(reached)  // bool (your condidtion)
                             {
                                     AvaAnimation.enabled = true; // animation starts
                             }
                     }
             }
           }  

Drag your game object which shall be animated in the Controler field in the animator component.
Then drag your game object in the public Animator field in the script. In my case all works fine and i hope this is helpfully for any other beginner as i am :)

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

Answer by mirzamzn1 · Feb 02, 2020 at 10:20 AM

please help me

The animation state Moveto could not be played because it couldn't be found! Please attach an animation clip with the name 'Moveto' or call this function only for existing animations. UnityEngine.Animation:Play(String) Ulti:MoveTo(GameObject, Vector2, Single) (at Assets/Scripts/Play/Ulti.cs:48) GameController:RuleChecker(GameObject, GameObject) (at Assets/Scripts/Other/GameController.cs:153) GameController:JewelSelecter() (at Assets/Scripts/Other/GameController.cs:99) GameController:Update() (at Assets/Scripts/Other/GameController.cs:70)

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

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

65 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

Related Questions

Animation Types Won't Play 0 Answers

Trying to get animation to work. Problem with JS. 1 Answer

Idle , Move and Attack animations 0 Answers

GetAnimatorTransitionInfo(0).IsName("Any State -> otherStateName") 0 Answers

Where to put ; 2 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