best way to handle the "character controller" component overwriting positions.

Hello, as per the title, the character controller (CC) is kind of bothering me. It has been more than 6 months since I created the movement system but since then, whenever I had to interact with the character in any way, the CC kept interfering in one way or another and I had to waste time figuring out that the CC was at fault, then find a solution.

for movements, wasted more than a day figuring out why it wasn’t working as expected with unity’s animator before realizing it was the CC and I had to use a dirty workaround, to change the position of the player (after changing scenes for examples) the CC kept overwriting their positions, and again I used a workaround.

Looking to buy animancer which appears to solve many of my issues with the default animator but I am afraid it the CC will give me even more troubles. If not, given my experience with it so far I will probably face more issues down the line.

So my question would be, how to “use” the CC in more complex situations to avoid dirty workarounds which are definitely time-consuming and counterintuitive?

All you need to do is this:

characterController.enabled = false;
characterController.transform.position = somePosition;
characterController.enabled = true;

Doesn’t seem dirty to me. And if three lines bother you so much, you can make it into an extension method.

in that particular case it is more counterintuitive than dirty.

But in the first scenario with the animator.

 private void OnAnimatorMove()
        {
            Vector3 velocity = animator.deltaPosition;
            //gravity logic
            velocity.y -= gravityMagnitude * Time.deltaTime;
            controller.Move(velocity);
        }
        private void Update()
        {
           
            playerRoot.transform.position += this.gameObject.transform.localPosition;
            this.gameObject.transform.localPosition = Vector3.zero;
        }

I had to place the controller on the child mesh instead of the parent and do something similar in order to get the player to move properly because the CC kept interfering. And disabling the CC every frame seemed needlessly expensive to use every frame on each character.

don’t remember the exact scenario because it happened months ago but this is how the movement logic ended up looking like.