'Transformation'' isn't existing in the current context

I was following a tutorial (which might be outdated) and I got this error: Assets\PlayerMovement.cs(33,25): error CS0103: The name ‘transformation’ does not exist in the current context. I’m assuming it might be related to variables but I’m not certain. Here is my script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    [Header("Movement")]
    public float moveSpeed = 6f;
     
     float horizontalMovement;
     float verticalMovement;
     
     Vector3 moveDirection;

     Rigidbody rb;

     private void Start() 
     {
        rb = GetComponent<Rigidbody>();
        rb.freezeRotation = true;
     }

    private void Update()
    {
        MyInput();
    }

    void MyInput()
    {
        horizontalMovement = Input.GetAxisRaw("Horizontal");
        verticalMovement = Input.GetAxisRaw("Vertical");

        moveDirection = transformation.forward * verticalMovement + transform.right * horizontalMovement;
    }

    private void FixedUpdate()
    {
        MovePlayer();
    }

    void MovePlayer()
    {
        rb.AddForce(moveDirection.normalized * moveSpeed, ForceMode.Acceleration);
    }
}

I don’t have a lot of knowledge of coding but I have tried it before.

Hi! The problem line this one:

moveDirection = transformation.forward * verticalMovement + transform.right * horizontalMovement;

More specifically, the compiler doesn’t like transformation.forward. You probably want to be using transform.forward instead.


P.S. In the future, take a closer look at the error message if you get one. It will lead you directly to the place that is giving the error: Your error was Assets\PlayerMovement.cs(33,25): error CS.... This part tells you the path to the script causing the error (Assets\PlayerMovement.cs), and the line and character of the error (line 33, 25th character).

If we look at the 33rd line and 25th charcter, we find this:

-> transformation.forward * verticalMovement + tra[...]

Which should also get red underlined in whatever IDE you’re using to edit your code.

Hope this helps!