Skip to content

Set Rect on a button

Ask for help here ;)

Set Rect on a button

Postby pSupaNova » 30 Apr 2011, 23:41

I Can't set a Rect structure on a Button. I want to be able to position a button in a scene without using a window.

In Code.
Syntax:
Using csharp Syntax Highlighting
void OnGUI () {
      if (GUI.Button (new Rect (Screen.width - 100,Screen.height - 50,100,50), backIcon)) {
                Application.LoadLevel(0);
      }
}
 
Parsed in 0.006 seconds, using GeSHi 1.0.8.4
User avatar
pSupaNova
 
Posts: 15
Joined: 20 Feb 2011, 15:10

Re: Set Rect on a button

Postby Neodrop » 01 May 2011, 00:05

You want to know how to do it in graph or what ?
User avatar
Neodrop
Администратор
 
Posts: 1068
Joined: 15 Jan 2011, 13:18

Re: Set Rect on a button

Postby Viziopleasure » 01 May 2011, 02:45

Yeah, I don't understand too. Doesn't the button blocks have a built-in rect?
User avatar
Viziopleasure
 
Posts: 115
Joined: 31 Mar 2011, 12:08

Re: Set Rect on a button

Postby Neodrop » 01 May 2011, 03:41

Like this ?
Attachments
guibutton.jpg
User avatar
Neodrop
Администратор
 
Posts: 1068
Joined: 15 Jan 2011, 13:18

Re: Set Rect on a button

Postby pSupaNova » 01 May 2011, 12:48

Thanks Neodrop that exactly what I wanted to do.
User avatar
pSupaNova
 
Posts: 15
Joined: 20 Feb 2011, 15:10

Re: Set Rect on a button

Postby pSupaNova » 01 May 2011, 15:28

Another question the variables/constants 100 & 50 in the graph how did you set them individually. Because when I alter one in the universe inspector panel both change.
User avatar
pSupaNova
 
Posts: 15
Joined: 20 Feb 2011, 15:10

Re: Set Rect on a button

Postby Neodrop » 01 May 2011, 15:43

Not so. Changed are only one. This is GUILayout bug and I can't fix it now.
Just Undock the Inspector Window and you will see the value correctly.
User avatar
Neodrop
Администратор
 
Posts: 1068
Joined: 15 Jan 2011, 13:18

Re: Set Rect on a button

Postby pSupaNova » 01 May 2011, 18:01

Thanks for the help. This is some seriously powerful tool you have created, It is worth the price just for the GUI building capabilty :D
User avatar
pSupaNova
 
Posts: 15
Joined: 20 Feb 2011, 15:10

Re: Set Rect on a button

Postby Neodrop » 01 May 2011, 18:25

Well, as seems to me, we have too much abilities. People are afraid of width of our possibilities. Afraid of bottomless of our Universe.
User avatar
Neodrop
Администратор
 
Posts: 1068
Joined: 15 Jan 2011, 13:18

Re: Set Rect on a button

Postby Trezvie » 27 Nov 2015, 14:15

The same interested me!
Trezvie
 
Posts: 13
Joined: 26 Nov 2015, 15:32


Return to HELP!!!

Who is online

Registered users: Yahoo [Bot]