- Home /
CharacterController.move called on inactive controller
Firstly, yes, I have seen similar posts, but most of them have no answers or were caused due to issues that are not applicable. For example, no nav mesh is needed for a player controlled character controller, and no updates have been made to my editor.
For some reason, the controller I'm trying to reference on a script is "inactive". This is weird for Unity to tell me because the controller is constantly moving all across the room but still the following code produces the message "called on inactive controller."
The Unity console gives me the message "CharacterController.move called on inactive controller," exactly as quoted even though the controller is enabled and is moving outside of this script. Could the issue be related to any character controller settings, like skin width, or something, or because it is serialized, or etcetera; Is there any explanation as to why this script does not work?
using UnityEngine;
public class harpoonLauncher : MonoBehaviour
{
private bool collided = false;
[SerializeField] private CharacterController playerReference;
private Rigidbody harpoonHead;
private void Start()
{
harpoonHead = GetComponent<Rigidbody>();
harpoonHead.AddRelativeForce(0f,0f,1000f);
}
private void OnCollisionEnter(Collision collision)
{
harpoonHead.velocity = Vector3.zero;
harpoonHead.constraints = RigidbodyConstraints.FreezeAll;
collided = true;
//make harpoonHead fly a bit forwards and freeze there.
}
private void Update()
{
if(collided)
{
playerReference.Move(Vector3.MoveTowards(playerReference.transform.position, harpoonHead.transform.position, 1f));
}//amount moved should increase the further from the center the player is[.
}
}
Are you sure you have the correct charactercontroller selected? Is the controller disabled by any other scripts or in the editor?
I have multiple player prefabs that are spawned in a multiplayer game. Each player prefab has it's own character controller, which is disabled to start with. I have a Network Behavior script that enables the character controller of a player if they're the local player. Now, I don't see any errors when the host player moves, but when the client player moves, I get the error "CharacterController.move called on inactive controller".
Answer by metalted · Jun 02, 2019 at 09:19 AM
" I have been plagued with this problem and I accidentally just got a clue why this was happening in my application. Try going to the character controller and changing the "step offset" variable. Mine was .3 and I changed it to something bigger like .35. This uncovered the following error msg...
"Step Offset must be less or equal to + * 2"
Even if I reset it back to it's original value of .3 I still got the error. Once I changed my step value to something that didn't give me an error (in my case .1) my controller started working again. My suspicion is that a U4 step offset value was not compatible with U5 but no warning was generated to that effect after the upgrade. "
(from: https://forum.unity.com/threads/charactercontroller-move-called-on-inactive-controller.488742/)
Found this on a forum. I'm not familiar with the problem myself but this might be something that can help you.
Your answer
Follow this Question
Related Questions
Character controller with Rigidbody to apply force 0 Answers
Top Down Mobile Game movement (rb or CC) 1 Answer
Having issues with Rigidbody and CharacterController colision 2 Answers
Make CharacterController act like rigidbody on explosions 1 Answer
Hi please tell me whats wrong with my player script. 1 Answer