Hello, I have a GameObject as a FSM Owner with an Animation component. On Both Play Animation Simple and Play Animation Advanced I get a “NullReferenceException: GetRef” error and I have no clue on how to fix it or what causes it. My animation is attached to the Animation component like the Sample Scenes “Character Point & Click Control”. I fully appreciate any assistance, and thank you in advance.
Can you please confirm that the animation clip you want to play is a legacy animation clip?
If you are unsure, please open up PlayAnimation.cs and add this line of code in the OnInit method: animationClip.value.legacy = true; so that the OnInit looks like this in the end:
By the way, the animationclip is added automaticaly for you if it’s not in the animation clips list of the Animation component, so that you don’t have to add it manualy.
I don’t know what kind of animation it is because I am making them in Unity itself. The only way I understand to check or change animation type is through the import settings if it was made in an external program like Blender. I assume they are Generic. Adding that line of code allows the animation to work. In fact, after commenting out that line the animation will continue to work until I close and reopen unity. I assume this line is doing some sort of type override for any animation that runs it, that remains after leaving play mode. I consider this to work for my error. Thank you for your quick response!
Thanks for letting me know.
I am glad it works for you now. Like I originally stated, this action is made to work with the legacy Animation component of unity and not with Animator one. Just a thing to remember 🙂
Thanks!
Join us on Discord: https://discord.gg/97q2Rjh
Author
Posts
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.