void Start() { anim = GetComponent <Animator>(); // Creates the controller controller = new AnimatorController(); controller.AddParameter("Go to A2", AnimatorControllerParameterType.Trigger); controller.AddParameter("Go to A1", AnimatorControllerParameterType.Trigger); controller.AddLayer("nakedLayer"); // Add StateMachines var rootStateMachine = controller.layers[0].stateMachine; //var stateMachineA = rootStateMachine.AddStateMachine("smA"); anim.runtimeAnimatorController = controller; dbcon = ScriptableObject.CreateInstance("dbConnector") as dbConnector; dbcon.LoadStuff(); pathReader = ScriptableObject.CreateInstance("PathReader") as PathReader; pathReader.Initialize(); mocapLoader = ScriptableObject.CreateInstance("MocapLoader") as MocapLoader; mocapLoader.Initialize(rootStateMachine); }