Why wont my attack script get the data from my movement script (error)?

So yeah, when I play test it, I get error in the line of the mouse0 input. Any idea?

Attack Script:

public float attackRate = 2f;
    float nextattackTime = 0f;

    public PlayerController PlayerController;

    void Update()
    {
        if (Time.time >= nextattackTime)
        {
            if (Input.GetKeyDown(KeyCode.Mouse0) && (PlayerController.isJumping == true))
            {
                CritAttack();
                nextattackTime = Time.time + 1f / attackRate;
            }
        }
    }

Movement script:

 void OnTriggerEnter2D(Collider2D collision)
    {
        if(collision.gameObject.tag == "Platform")
        {
            isJumping = false;
        }
    }
    void OnTriggerExit2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Platform")
        {
            isJumping = true;
        }
    }

Hi, @duducarry ,


At top you have:

public PlayerController
PlayerController;

change for:

public PlayerController
m_PlayerController;


then :

if (Input.GetKeyDown(KeyCode.Mouse0)
&& (PlayerController.isJumping == true))

Change for:

if (Input.GetKeyDown(KeyCode.Mouse0)
&& (m_PlayerControler.isJumping == true))


Also remeber about ataching component in inspector for it.

Hope will do.