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 /
avatar image
0
Question by JonathanSegal · Jun 29, 2018 at 02:44 AM · animatoranimator controlleranimationsprefab-instanceprefab connection

State could not be found, despite having a State with that name.

Hi, I've been doing research, and it seems like no one has this exact problem. If this is a repost, I'm very sorry!

I have a script that I want to play an animation from attached to a prefab. Even though the attached animator has a state of the name I'm trying to call (I've checked, they're the same), it simply won't find the state from the instantiation of the prefab! I think the animator must be attached incorrectly for some reason, but I don't understand why.

This is the code that attaches the animator and plays the animation alt text And this is inside the actual animator. As you can see, the state name (Wheat_Stage_1_Animation) is the same as it is inside the code. alt text The weirdest part is I have another set of gameobjects instantiated from a prefab in the same way that call basically exactly this code and it works. They have a different Animation controller and different stage names, but other than that it's basically the same stuff. suuuper weird. Also frustrating. I'd show pics of that, but I can only upload 2 images :|

Any insight would be appreciated, thanks so much!

Update: The problem appears to be that the animator that's actually getting attached is the animator for that different set of gameObjects that look very similar to the other ones and share a script. Why, I do not know. It seems like the new instantiation should have a different instance of the animator, but idk. For now I'm just going to add all relevant animations to both of the animators that are getting used, but a way around that would be great!

question-code.png (8.5 kB)
inside-the-animator.png (164.3 kB)
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 hectorux · Jun 29, 2018 at 04:44 AM

I think you have to make a transition between your empty and the animation. I think that should work without changing your code.

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 JonathanSegal · Jun 29, 2018 at 01:25 PM 0
Share

Hey, thanks for the message @hectorux! Unfortunately, when I add a transition with a trigger (called "Wheat_1") it still can't find the parameter or the state as you can see below. I think the animator isn't attached in the code for some weird reason. I tried deleting the animator and making a new one, but no dice. alt text

with-trigger.png (484.3 kB)

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

101 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

Related Questions

Change Animator Parameters on Different Object - Prefabs 1 Answer

How to rotate an object with a script after an animation has rotated it? 1 Answer

Losing Animator state on Disable/Re-enable? 0 Answers

Fade in scene transition animation running for less time than fade out 0 Answers

How to auto add animation clips 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