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][1]
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][2]
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!
[1]: /storage/temp/119801-question-code.png
[2]: /storage/temp/119802-inside-the-animator.png
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!
↧