PlayerController and setting a variable

Hello, Everybody.
I am looking at implementing a PlayerController system for controlling the local player in my MMO.
When the player position changes I need to change a variable called MovementDirty to true to update the variables serverside.
How could I do this ONLY when the character has moved?

One option would be to store the old position, and compare it with the current position each frame, as follows:

Vector3 oldPosition;

void Update()
{
    if(oldPosition != transform.position)
    {
        // your action to be triggered when the player has moved
    }
    oldPosition = transform.position;
}

Hope this helps.

Cheers

Bilo