Is there ANY way to create a animator controller and paremeters thru Scripting/ Code?
Is there ANY way to create a animator controller and paremeters thru Scripting/ Code?
Instead of attaching and connecting parameters and etc, how can I do this by code? I think its a excellent idea to be able to do this, because if we could we could easily copy and paste to other projects without having to import and search for the acs, so with scripts you can easily carry them over anywhere. please advise anyone
and yes I know you can cntrl +d to copy in same scene but that doesn't help if you want to copy the ac to another project
Answer by Tourist · Nov 04, 2016 at 09:33 AM
the animator controller is an asset. Therefore, you can copy the .controller file into the other project.
As for scripting the creation, have you tried : AnimatorController controller = new AnimatorController(); AssetDatabase.CreateAsset(controller, assetPath);
(Not tested though)
Answer by Cynikal · Nov 04, 2016 at 10:43 AM
public Animator _MyAnimator;
// Use this for initialization
void Start()
{
_MyAnimator = gameObject.AddComponent<Animator>();
//Set the parameters of _MyAnimator here.. }