I apologise in advance for what is mostly likely a stupid question. I’m an experienced developer, but not in this world, and in the last few weeks I’ve started using Unity at home for personal fun projects.
This week I purchased my first store assets, and I’ve become a bit stuck on how to use the .fbx packages they come in.
An example: I purchased a bird flock pack - hoping to use the models and animations. I’ve no interest in the flocking scripts, as I made my own.
My intention was to use the model, mesh, add an animation controller, and then add use the animations as I need, as I want to use the animations in different orders.
I’m completely stuck on how to do it.
I have an fbx with three animations, a root, mesh and also a material.
Have you looked at the manual page for animation controllers?
Your bird object needs a skinned-mesh renderer, obviously, and also an animator component. Since this is an asset that you bought, these are probably on there by default.
If you’re impatient and want a shortcut, here’s what you can do:
Create a new animator controller
in the animator window, just drag all of the animations that want to use in there. Don’t worry about creating transitions.
In your code, just get a reference to your object’s animator and call Animator.Play whenever you want a specific animation to play.
The only drawback of this method is that you aren’t setting-up custom smooth transitions between each animations.
Did you want to figure out how to use the Asset’s already-existing animator controller, rather than make your own?
Yes, I did read the docs, and thank you for the reply.
Before posting I had managed to get it working with other assets, just like you described (one was also a butterfly), but with these assets there is no animation controller, and as a newbie, I’m getting confused.
You can see the model and prefab below.
The prefab has an animation with the three clips.
What I tried was removing the animation object, adding an animator and adding the animations from the model (using ctrl+d to extract them first) and adding these to the controller.
However no animation happens. I noticed that the other assets I have that work have an avatar, and these assets below don’t seem to.
I promise I’ve looked at the docs, but this is a bit confusing when you first see it all. I’ve done endless searches as well - but all the examples seem to have an avatar in the model.
So, I removed the animation component and added a controller. The controller has one of the animations in the model, which I exrtracted from the fbx using ctrl + d.
It looks like that model was made to use the legacy animation system from before the animator component was introduced. It should still work, though. Look at the import settings on the model. If the rig is set to “legacy” try changing it to “generic” instead. I think it should generate an “avatar” for the model. Drag the avatar into the avatar field of the animator component (right now it says “None”).