Moving Platform and CharacterController.Move not working. The player falls

I am using CharacterController.Move to move the player, and I make the player child of the moving platform to move with it, but it is not working, the player doesn’t move with the platform.

private void OnTriggerEnter(Collider other) 
    {
        if (other.tag == "Platform") 
        {
            transform.parent = other.transform.parent; 
        }
}
private void OnTriggerExit(Collider other) 
    {
        if (other.tag == "Platform") 
        {
            transform.parent = null; 
        }
    }

This up code works well, the player change and takes the platform as parent. But the player falls, and not moving with the platform.

  if (Control.isGrounded)
        {

            MoveDir = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); 
            MoveDir *= Speed; 
            JumpCount = 0; 
        }
        else 
        {
            MoveDir = new Vector3(Input.GetAxis("Horizontal") * Speed, MoveDir.y, Input.GetAxis("Vertical") * Speed);
        }
        if (Input.GetButtonDown("Jump") && JumpCount < TotalJumps) 
        {
            JumpCount++;
            MoveDir.y = JumpSpeed;
        }
        MoveDir.y -= Gravity * Time.deltaTime;
        if (ActivateMove)
        {
            if (MoveDir != Vector3.zero)
            {
                Control.Move(MoveDir * Time.deltaTime);
            }  
        }

This is the player moving script. I put a boolean “ActivateMove” to desactivate the movement and check, if is desactivate the player moves with the platorm and it works. But I can’t desactive the movement when the player is in the moving platform becouse I want to move it in the platform too.

Thank you.

It’s an old topic, but I just had the same issue. I moved my old project to new unity and new render pipeline system and same script, same player and same platform stopped working.


For me changing from Update to FixedUpdate was not the right solution as other triggers on the platform stopped working properly (they worked, but…during specific frames only?).


After checking all the topics with rigidbody, OnTriggerStay, position correction and so on, I found out that there is ‘auto sync transforms’ option which was not enabled in my new project. When I reenabled it, things went back to normal. (Edit → Project Settings → Physics (or Physics 2d) → Auto Sync Transforms

I finally made it, Changing the Platform code from Update to FixedUpdate, it works well. I don’t know why, but works. Searching I found the solution here: Character Controller doesn't move with a moving parent - Questions & Answers - Unity Discussions

The reason why it is not working it’s because you are not saving the transform to the physics engine.

If you have Physics.autoSyncTransforms enable, which is not by default, could also be a potential fix.
Otherwise, “When set to false, synchronization only occurs prior to the physics simulation step during the Fixed Update.” which explain why the solution you found works.