Top Only function not working correctly

I have certain buttons on the screen that should not be clickable when a certain image appears over them, so I’m trying to set the top only on true when it appears and then setting it to false again when it disappears (I need this to drag some other buttons around).
The thing is that this isn’t working properly, if I console.log the top only property, it says that it is changing accordingly to what I need, but that’s not true, since I can still click any button behind the image.

Noninteractive game objects can’t block interactive game objects.

And topOnly is already on by default.

I put top Only on false in order to drag the buttons by default, is it’s initial value, the image that covers the buttons is interactive as well, it was working before, but now it doesn’t and I don’t know what the problem might be…

I just solved it, the problem was that I was using 5 images that cover the buttons, and later I deleted one of those, so the if condition wasn’t working properly as it was trying to check if that deleted image was visible or not.