Calling function from other script doesn't change its variables.

I am currently stuck with this problem.

I have two scripts: IRChandler and Movement. My goal is to call a funtion in Movement via IRChandler, which is done as follows:


public Movement playerControls;

Then, inside unity, the object with the Movement script is dragged into the inspector. Later on in the code, I try calling a function moveUp from Movement.

 if (Input.GetKeyUp("w"))
           Debug.Log("Moving Up");

The function looks like this:


public void moveUp()
        Debug.Log("Function Accessed");
        moving = true;
        endpos = transform.position + Vector3.forward;


The function gets called, as I get the debug message in the console, but none of the variables (moving and endpos) actually get changed. If I call the same function from the Movement script, everything works as intended. I have played around with many possible solutions over the past few hours, but I just cant seem to figure it out.

Thanks for the answer. I actually fixed the issue myself by changing the call command to:

if (Input.GetKeyUp("w"))
            //Debug.Log("Moving Up");

it is really weird though, because it seems like the same syntax to me, but this one actually works