Netcode for Gameobjects | Update vs FixedUpdate method

private void Update()
{
    if (Input.GetKeyDown(KeyCode.T))
    {
        transform.position = Vector3.zero;
    }
}

private void FixedUpdate()
{
    if (Input.GetKeyDown(KeyCode.T))
    {
        transform.position = Vector3.zero;
    }
}

Why does changing position work in FixedUpdate method but not in Update method?

I searched for the answer but couldn’t find it.

Possibly because the GameObject is question is driven by a Rigidbody, but this is just a guess since you have provided no context. In any case this is a forum for questions about Cinemachine; you should ask this question on a different forum.

I’m sorry, i didn’t notice

Don‘t use Input in FixedUpdate or you will miss input events. Input is sampled at the Update rate (60+ Hz), FixedUpdate runs at 50 Hz by default.

1 Like