GetMouseButtonUp not checking.

Relatively complicated problem.
I have a check to see if there is another object that is dragged using mouse drag on top of preset slots for them. What I’m trying to set up now is a new check where if the mouse up is true and the check for a certain block is true it moves the block to the same coordinates as the slot making them one on top of each other. I’m not sure whats wrong. My slot check it working find but the button check isn’t. Any thoughts or ideas? Bellow is the mouse check code.

function OnMouseUp(){

if(Input.GetMouseButtonUp == true);
check = -1;

if(count == 1)



Input.GetMouseButtonUp is working only in the Update() function, as it is explained in the documentation here. So this won’t work in OnMouseUp function. If you are in the OnMouseUp function, you can state that Input.GetMouseButtonUp is obviously true.

Then don’t put a “;” juste after an “if” statement.

This code is totally wrong. It can’t be compiled!

If you want use GetMouseButtonUp, is a method, you have to call it with parameter (button int index). See docs on link.

I think that you can’t test Input.GetMouseButtonUp INSIDE OnMouseUp. Call it from Update(). If you want use MonoBehaviour.OnMouseUp(), you don’t need another test.
This method are called only when mouse button is released.

EDIT: How tell KiraSensei, there is a wrong “;” after if, too.