x


Create GUI at mousePosition.

Hello everyone :)

Is there a way that you can create a GUI that has the position of the mouse?

E.g:

function OnMouseOver ()
{
//Set stuff to true;
}

function OnGUI ()
{
if(stuff)
   {
    //Set GUI at mouse position.
   }
}

I do know how to create the GUI and all that but, I have no idea how to create the GUI at the position of the mouse.

Can you please help me? :)

more ▼

asked Mar 24 '11 at 09:24 PM

OrangeLightning gravatar image

OrangeLightning
5.4k 47 57 113

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

1 answer: sort voted first

You could use Input.mousePosition to get the position in pixel coordinates (screen coordinates) and then use this values to draw your GUI.

more ▼

answered Mar 24 '11 at 09:36 PM

efge gravatar image

efge
5.1k 5 14 40

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

x3816
x77
x50

asked: Mar 24 '11 at 09:24 PM

Seen: 1673 times

Last Updated: Mar 24 '11 at 09:24 PM