I have a mesh with an “animator” component and an “animator controller” asset with animations. The animations are working on the mesh, when I drag and drop the animator controller to the animator component.
But I have to do this by script. This seems to be impossible. Is there a workaround? What is the best practice?
I don’t know if I understand this right or if there is a way to set it with script but maybe you could create different prefabs, with and without the animator controller, and instantiate those when you will ?
I can’t create prefabs, because I create the mesh (a character) by script from different pieces. This is because the character is customizable and can have different heads, hands, feet and so on.
I also asked the question here :
It kind of sucks, maybe you can still do it with a prefab, by loading a simple prefab with just the controller set and then modify it with a script.
More importantly this kind of breaks the unity design, I was assuming all properties that you can modify in the inspector by hand were also accessible by script. It seems that is not the case so you can do a lot of coding work and find out it’s useless at the end.