Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Problem with a Dashing script

Hello everyone!

I am having a problem with a script for dashing I am trying to write for a character controller player I made with Brackey's tutorial I followed some months ago...

Basically the character script works perfectly but the other script I made for dashing I made doesn't and it give me this error that moveDir doesn't have a definition....

Here is some screenshots of the dashing script and the character script

I would really appreciate it if you helped me with this cause I am still new to programming and coding so I am still having a hard time figuring things out...

Thanks you!

~Black


Answers

  • edited October 2020

    moveDir is in you update function so its not global. If you want to reference something in another script it should look like this:

    public variable;

    returntype()

    {

    variable = value;

    }

    *edit because my explanation was confusing and I dont want to confuse anyone else

    In this script it looks like this:

    public Vector3 moveDir;

    void Update()

    {

    //yourmovement code

    moveDir = (//yourmath(Must be of type Vector3));

    }

Sign In or Register to comment.