Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

CharacterController.Move not working with Quality Settings.VSyncCount = Don't Sync

Discussion in 'Physics' started by Maeslezo, Oct 17, 2018.

  1. Maeslezo

    Maeslezo

    Joined:
    Jun 16, 2015
    Posts:
    325
    CharacterController.Move is not working in the build.

    In Editor works perfectly
    It depends on the quality settings. In Ultra works, in Very Low doesn't work.

    I have checked that the guilty setting is V Sync Count.

    Don't Sync => Doesn't work
    Every V Blank => Works

    This is very weird. I don't understand what have to do VSyncCount with CharacterController.

    I attach a package with only one scene and one script if someone wants to check
     

    Attached Files:

  2. Maeslezo

    Maeslezo

    Joined:
    Jun 16, 2015
    Posts:
    325
    I answer myself if someone has the same problem.

    The problem is to do the CharacterController.Move in the Update, as Unity does in the documentation.

    If CharacterController.Move is done in FixedUpdate, it works with V Sync Count = Don't Sync

    https://docs.unity3d.com/ScriptReference/CharacterController.Move.html
    void Update()
    {
    (...)
    characterController.Move(moveDirection * Time.deltaTime);
    }


    CharacterController.Move as to be done in the FixedUpdate, although , in theory, FixedUpdate is for using rigidbodies and CharacterController is a Collider, created explicitly for not using a rigidbody.
    https://docs.unity3d.com/ScriptReference/CharacterController.html
    https://docs.unity3d.com/ScriptReference/MonoBehaviour.FixedUpdate.html
     
    Last edited: Oct 18, 2018