StateMachineBehaviours are not available after creating AnimatorControllerPlayable

I’m creating AnimatorControllerPlayable from AnimatorController. After entering playing mode, it is playing ok, but all StateMachineBehaviours in this AnimatorController disapear (and of course are not working).

For normal Animator after entering Play Mode all StateMachineBehaviours are recreated as clones, but it is not working for AnimatorControllerPlayable.

BUT when during Play Mode I add in Animator Window new StateMachineBehaviour to some state in AnimatorController it is added AND all other StateMachineBehaviours are initialized and working OK.

Am I missing some initialization for AnimatorControllerPlayable?

UPDATE: Animator.GetBehaviours() after creating PlayableGraph with AnimatorControllerPlayable returns correct amount of StateMachineBehaviours, so it looks like they are added but not initialized.

Ok. I found my problem (I don’t know if it is working as intended, but maybe solution will help someone).

I was creating AnimatorControllerPlayable from RuntimeAnimatorController in Animator:

Animator Anim;
//creating PlayableGraph from AnimatorController
InitAnimator(Anim.runtimeAnimatorController);
//set AnimatorController to null because it messes with PlayableGraph
Anim.runtimeAnimatorController = null;

My solution is set controller to null before creating PlayableGraph and it’s working:

Animator Anim;
RuntimeAnimatorController mainAnimator = Anim.runtimeAnimatorController;
//set AnimatorController to null because it messes with PlayableGraph
Anim.runtimeAnimatorController = null;
//creating PlayableGraph from AnimatorController
InitAnimator(mainAnimator);