x


Unity Buttons

Is there any way to turn a game object into a clickable button? I'd like to be able to make buttons without using unitygui.

more ▼

asked Dec 13 '11 at 03:05 AM

UnityNo0b gravatar image

UnityNo0b
16 1 1 1

Yes, you can use Collider.raycast along with mouse screen coordinates to find out if the player has clicked a given object. However, implementing this kind of thing is much more difficult than using UnityGUI, so only do it if you really have to.

Dec 13 '11 at 03:06 AM syclamoth

OnMouseDown(){ do this; do that; } attached to some game object makes it clickable, but doesn't turn it into a button.

Dec 13 '11 at 03:11 AM Lo0NuhtiK

try to use ray cast hit

Dec 13 '11 at 03:31 AM robert_mathew
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

http://answers.unity3d.com/questions/143480/raycasthit-explanation-wanted.html

see this answer you will get idea about ray cast hit make the camera as Main Camera

more ▼

answered Dec 13 '11 at 03:35 AM

robert_mathew gravatar image

robert_mathew
522 27 36 44

(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:

x1952
x109

asked: Dec 13 '11 at 03:05 AM

Seen: 705 times

Last Updated: Dec 13 '11 at 03:35 AM