Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Rabagast on September 11, 2013, 04:12:40 AM

Title: GUI Position [SOLVED]
Post by: Rabagast on September 11, 2013, 04:12:40 AM
Hi!
How can I position a GUILayout Int Label?
It's always placed on the top/left screen.
I want it to be placed on a cube at the
center/bottom of the screen. How can I do that?

Thanks! :)
Title: Re: GUI Position
Post by: jeanfabre on September 11, 2013, 05:46:01 AM
Hi,

 for this, you need several things:
1: Create a guiskin
2: modify the label entry
 -- alignment: MiddleCenter
 -- Stretch Width: true
 -- Stretch Height: true
3: set this skin for your state using action "set Gui Skin"
4: using the action GUILayoutBeginAreaFollowObject to have your gui follow an object
5: set the area of this action above like so
Offset Left: -100
Offset Top:100
Width : 200
Height : 200
Normalized : False
3: add your label inside this area

and you will have a perfectly centered label on top of your object.

 Bye,

 Jean
Title: Re: GUI Position
Post by: Rabagast on September 11, 2013, 09:04:58 AM
Ok, but how can I create a GUIskin?
Title: Re: GUI Position
Post by: Lane on September 11, 2013, 09:08:29 AM
Assets>Create>GUI Skin
Title: Re: GUI Position
Post by: Rabagast on September 11, 2013, 09:21:21 AM
Thanks Lane!

But I get this error:

"GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced)"

I use this two actions in the same state!
-Set GUI Skin
-GUILayout Begin Area Follow Object

I tried to disable Set GUI Skin. The error disappeared.
So it need to be something with the Set GUI Skin

What do I wrong?
Title: Re: GUI Position
Post by: Lane on September 11, 2013, 09:29:07 AM
If you Begin a GUI Layout Area then you have to end it with GUI Layout End Area
Title: Re: GUI Position
Post by: Rabagast on September 11, 2013, 09:31:47 AM
Yes, I found it out :-)

I will just try to experiment a little bit at my own, but maybe I need more help. :)
Title: Re: GUI Position
Post by: Rabagast on September 11, 2013, 09:44:25 AM
Ok, I made a GUI Label which is is placed in the middle of the screen. But not on the Cube.

But What about GUILayout Int Label. I have that in the same State, but this is placed in the upper left corner of the screen. Is it possible to change the position of this?
Title: Re: GUI Position
Post by: Lane on September 11, 2013, 10:33:29 AM
The GUI actions you put between the Begin and End Layout actions will follow the Layout area. If the Layout Begin is following something, its sub-actions should also follow it.
Title: Re: GUI Position
Post by: Rabagast on September 11, 2013, 03:32:16 PM
Yes, that's right! The GUILayout Int Label was not between the Begin and End Layout! Now everything is working!
Thanks! :)