x


GUI.Button click trigger game object

How can I prevent a GUI.Button click go through the Game area, currently when I was clicking on the GUI.button which cover a game object it will also trigger my game object action too.

more ▼

asked Oct 30 '11 at 07:59 PM

einnhann gravatar image

einnhann
-4 7 9 11

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

pull the raycast code you are doing out of the update loop you are using for it. Instead, in your gui code when you check for button presses, assign a mouse action that the gui code won't use as your raycast method. If your gui code doesn't use a mouse down event, for example, then you can add your raycasting there.

more ▼

answered Oct 31 '11 at 06:06 AM

jordanmisiura gravatar image

jordanmisiura
1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3892
x3813
x820

asked: Oct 30 '11 at 07:59 PM

Seen: 1169 times

Last Updated: Oct 31 '11 at 06:06 AM