character switching problem

this is really baffling me and could use the help
ill be specific as possible

i have two 3rd person characters on the screen, when the player presses the “w” key it turns off player 1’s controls, camera and player 2’s AI and then turns on player 2’s controls, camera and player 1’s AI

so basically you switch character. it does this using GetComponentInChildren(code).enabled
it works fine to a degree.

heres my problem

when it switches even though it switches the AI off from player 2 he still follows the waypoints and if i remove the AI completely the character controller although on does not work

any ideas?

oh and the AI is from the tutorial on the unity website.

thanks (btw im an artist by trade so sorry if this is ridiculously stupid)

I think that you can't just limit enabling ONE of the scripts on the alter ego. What you actually need is BOTH set of scripts on BOTH characters so, if your main character needs, say, three scripts

1- charactermotor 2- characterinput 3- characteranimation

and your alter ego needs two scripts

1- characterai 2- charactermotorai

you need to add ALL those scripts to BOTH characters

and then disable or enable the respective 'sets' when one of them becomes the player character. Of course, if you can't achieve this right now, you'll need to reorganize your scripts (for example subdividing them, or adding boolean control variables inside them) in a manner that this becomes possible.