I'm following a tutorial for making a simple shooter in Unity, but I have a problem. FixedUpdate() is never being called. I tested Update(), and it was being called as it should be. Normally I would usually just use Update(), but everyone says FixedUpdate() should be used. This is my script:

using UnityEngine;

public class PlayerMovement : MonoBehaviour
    public float speed = 6f;

    Vector3 movement;
    Animator anim;
    Rigidbody playerRigidbody;
    int floorMask;
    float camRayLength = 100f;

    void Awake()
        floorMask = LayerMask.GetMask("Floor");
        anim = GetComponent<Animator>();
        playerRigidbody = GetComponent<Rigidbody>();

    void FixedUpate()
        Debug.Log("fixedUpdate hit");
        float h = Input.GetAxisRaw("Horizontal");
        float v = Input.GetAxisRaw("Vertical");

        Move(h, v);
        Animating(h, v);

    void Move(float h, float v)

        movement.Set(h, 0f, v);
        movement = movement.normalized * speed * Time.deltaTime;
        playerRigidbody.MovePosition(transform.position + movement);

    void Turning()
        Ray camRay = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit floorHit;
        if(Physics.Raycast(camRay, out floorHit, camRayLength, floorMask))
            Vector3 playerToMouse = floorHit.point - transform.position;
            playerToMouse.y = 0f;

            Quaternion newRotation = Quaternion.LookRotation(playerToMouse);

    void Animating(float h, float v)
        bool walking = h != 0f || v != 0f;
        anim.SetBool("IsWalking", walking);

Thanks in advance!

  • \$\begingroup\$ you have misspelling! FixedUpate is wrong FixedUpdate is correct add 'd' \$\endgroup\$ – Seyed Morteza Kamali Aug 20 '17 at 2:30

As addressed in the comments, you must use correct spelling, when calling these methods. They are called, internally, so miss-spelt methods will not be called.

Your calling FixedUpate; you need to call FixedUpdate.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.