x


How do I set up an invisible Button?

How do I set up an invisible Button?

On click to jump.

more ▼

asked Jul 04 '10 at 05:13 PM

MikezNesh gravatar image

MikezNesh
843 64 74 93

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

2 answers: sort voted first

from OnGUI (using normal rect positions for button):

if (Event.current.type == EventType.MouseUp && yourInvisibleButtonRect.Contains(Event.current.mousePosition))
{
    //jump
}

from Update (the rect needs to be defined with bottom left of the screen at 0,0):

if (Input.GetMouseButtonDown(0) && yourInvisibleButtonRect.Contains(Input.mousePosition))
{
    //jump
}
more ▼

answered Jul 04 '10 at 06:28 PM

Mike 3 gravatar image

Mike 3
30.5k 10 65 252

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

Create a GUIskin or GUIStyle with the texture of the Button as a fully transparent. The button will be invisible but will retain all normal Button functionality.

more ▼

answered Jul 04 '10 at 05:45 PM

JonManatee gravatar image

JonManatee
251 7 8 18

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

x786
x335
x124

asked: Jul 04 '10 at 05:13 PM

Seen: 2785 times

Last Updated: Jul 04 '10 at 05:13 PM