[22:05:34] CharacterController.Move called on inactive controller
UnityEngine.CharacterController:Move(UnityEngine.Vector3)
[22:05:34] There are 2 audio listeners in the scene. Please ensure there is always exactly one au
这是Unity引擎的一条警告信息,意思是CharacterController.Move函数被调用了,但是这个CharacterController组件处于未激活状态,可能会影响游戏逻辑。
解决方法是在调用CharacterController.Move函数之前,先判断该组件是否处于激活状态,如果未激活,则不要调用该函数。可以使用以下代码进行判断:
if (GetComponent<CharacterController>().isActiveAndEnabled)
{
// 调用Move函数
GetComponent<CharacterController>().Move(movement);
}
另外,这条信息还提示了场景中存在两个AudioListener,这是不推荐的,因为每帧只能有一个AudioListener生效。如果您确实需要使用多个AudioListener,请在代码中控制它们的启用和禁用,保证每帧只有一个生效。