Clicking on GUI ???

Im having some trouble here , im trying to make a FPS .

My shot action is set on Left Mouse button ((Fire1)) , and ive got GUI sliders too .

the problem is :

When i wanna interact with my sliders , i acidently shot due to left mouse button controling the slider

So unity awsome comunoty , How do i make it so my Shot action doesnt proc when i click my GUI?

xoxoxo nerk

Generally GUI sliders are in a menu screen that you switch on, and when you switch to the menu screen you disable all character controls and enable the mouse cursor.

I wish there was a better solution for this.

I want to be able to have buttons I click that don’t do the normal mouse action.

Yeah, best solution I’ve found for this is to have a static class with generic list of rects, List and to fill it with rects covering your GUI buttons/sliders ect.

Then have a MouseWorldClickAllowd(Vector2 pos) static function return true or false and pass in the mouse screen coordinates. Have that function iterate over the list of rects and use rect.Contains(pos), returning false as soon as you get a hit or true if you reach the end of the list.

Then just wrap all of your 3D world object picking with an if( MouseWorldClickAllowd(mousePos)) { do picking here }…

It’s ugly, but it works.