Help!i want donot effect my script on UI

When I first read this, I thought the OP was saying he has a script that displays an image when the mouse is pressed down. However, when he pushes a button to open the menu, the mouse down is also registered and showing the image, and that is not desired.

If that’s the case, you should check like this:

if(Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject()) image.SetActive(true);

If you meant something else, sorry :slight_smile: If it’s not what @dgoyette said, perhaps you can try to explain it a little better.

Please take a moment to look at this page for how to post code on the forums, nicely formatted and easy to read: Using code tags properly

Please try to re-read your post after you submit and edit any glaring mistakes. :slight_smile: (ie: random ‘/’ or ‘!’ in your message lol)

1 Like