unity – Executing before Update / LastUpdate method


I have in my game a button that when I click on it, it gives me the option to spawn some element. I also have another button that when I click it, I have an ‘eraser’ that is capable of destroying game object when the mouse clicks on them.

When I am pressing the eraser button, I also turn off the previus button:

public void EnableEraserButton()
{
    VertexButtonPressed = false;
    EraserButtonPressed = true;
}

But when I run the game, the LastUpdate mehthod runs before this method (I think), and not only I press the button but it also generates another game object under the eraser button, How can I fix it?