I’m having trouble getting animation to play with both the Animation and Animator components and am wondering if my scripting is incorrect.
I have an FBX which was exported from Blender with several Animation Clips:
I then made a refab from the FBX file, because I needed to attach some scripts to it, and I cant add components onto a imported model.
I added a Animation component and under its animations list, I placed the 2 animations:
In a script I have the following to play the animation:
Debug.Log("Playing Clip: " + _int.Clip_Name + "|" + (anim.GetClip(_int.Clip_Name) != null).ToString());
anim.clip = anim.GetClip(_int.Clip_Name);
anim.Play();
However the animations never play. I’ve checked that the clip is found using a debug message Debug.Log((anim.getclip(“clip name”) != null).tostring()). I’ve also checked that the animations work from the preview, and from just directly putting the animation clip into the clip parameters of the Animation Component and setting it to auto play on start, and it plays properly. I’ve also tried switching to the newer Animator component, adding the new animation clips into it and trying that way. Nothing I do seem to work.
Here’s some settings on my imported model - not sure if it has anything to do with it.
Anyone got ideas what I’m doing wrong. I’m using Unity 2021.13.20. Note that I had to put the rig to Legacy Mode because Unity throws me an error telling me I have to if I dont.