I cannot reference PlayerMovement in my game

i watched a tutorial. hes making a reference for PlayerMovement. its not working pls help.

private Animator anim;
private PlayerMovement playerMovement;

heere the “PlayerMovement” shows an error. how to fix?

1 Like
  1. Which Tutorial?
  2. Please, Provide the error itself.
  3. Please, Provide both classes: this class and PlayerMovement class. Use “Preformatted text” button.
  1. https://youtu.be/PUpC44Q64zY?si=JkmO-uHQSSYKDx22

using UnityEngine;

public class PlayerAttack : MonoBehaviour

{
    [SerializeField] private float attackCooldown;
    private Animator Animator;
    private PlayerMovement playerAttack;

    private void Awake()
    {
        Animator = GetComponent<Animator>();
    }

}

1 Like

this is how much ive made till yet. It wasnt working so I stopped. Its working for the guy in the tutorial tho

1 Like

You didn’t provide PlayerMovement class. I guess, you don’t have it.
So, the error is correct.

how do i fix it

1 Like

the guy in the tutorial doesnt have it either, but it works for him

1 Like

At the start of the tutorial, he provides 2 links for GutHub with needed staff. Use it.
So, for example, this is your class.

oh okay thank you so much

1 Like