- Home /
Character Controller Auto Re-enables itself.
I manually disable the component in the editor and the moment I hit play to compile the game, it turns itself back on. I'm practicing making a multiplier FPS game and I've managed to have cameras, sound listeners and FPSController default to disabled on launch and then set them to enable after they've joined the network. All except for Character Controller which I believe to be the culprit for an error I'm getting (NullReferenceException) on the line
if (!_characterController.isGrounded) return;
Which I think is due too double Character controllers existing in one scene at launch. (Since we have multiple players).
The first person Controller script is the one that you get from the 4.6 Beta Sample Assets and it has a [RequireComponent(typeof (CharacterController))] at the top which I've committed out thinking to be the culprit to the ren-enabling but it still does so even without said line of code.
So to sum up. I get an error regarding character controller the moment a second player joins. I realize that I've set all components except for Character Controller to disable on default (only to be re-enabled manually under photonView.isMine). Find out that Character Controller won't stay disabled. Post here hoping for help.
Answer by nonlin · Feb 05, 2015 at 07:38 AM
So I figured it out while trying to solve another issue I had.
I was attempting to disable a collider on my capsule to prevent any raycasting on it and used this line.
transform.GetComponent().enabled = false;
To my surprise I got errors stating my Character Controller was disabled.
SO guess what! Disabling the collider disables the character controller!
I finally got rid of my error in regards to that, although still having trouble with my new problem. Hope this helps someone in the future.
Your answer
![](https://koobas.hobune.stream/wayback/20220613181825im_/https://answers.unity.com/themes/thub/images/avi.jpg)