playMaker

Author Topic: SOLVED!! Centering gui elements, whatever screensize.  (Read 11098 times)

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Re: Centering gui elements, whatever screensize.
« Reply #15 on: August 13, 2013, 10:25:03 AM »
Have to just bump this, tried afew things.. but GUIText is not showing up on screen, Although the SetGuiText Playmaker component IS filling up with my string variable from HOTween string...
I see what you mean that the Inspector component has lots of piositioning options, its just not showing up..?

Any ideas? A demo perhaps?

Mark

Hi,

 you can have text using GuiText, just like GuiTexture. Simply go to the unity menu "GameObject/Create/Gui Text"

and you'll have all you need to center on screen, AND having an offset based on that center, using Pixel Offset.

Bye,

Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Centering gui elements, whatever screensize.
« Reply #16 on: August 14, 2013, 03:38:00 AM »
Hi,

 ok, try the scene I attached. It works with hotween and has a crosshair set up with graphic and text.

 to operate the typewriter. simply select "Crosshair text" and in the playmaker component inspector, set the "target" string to something and then press "WRITE" and it will be animated.

 I think this is what you aim right?


bye,

Jean
« Last Edit: August 14, 2013, 06:23:23 AM by jeanfabre »

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Re: Centering gui elements, whatever screensize.
« Reply #17 on: August 14, 2013, 06:16:56 AM »
I think you forgot to attach your scene?
 :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Centering gui elements, whatever screensize.
« Reply #18 on: August 14, 2013, 06:23:41 AM »
d'oh...

updated.

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Re: Centering gui elements, whatever screensize.
« Reply #19 on: August 14, 2013, 07:01:25 AM »
Thanks Jean!

This totally working as I want it in your example, I had to adjust the pixel offset on the GuiText component to get it exactly where I needed it, but it worked, and then DID stay in place when I adjusted screen shape.
So far so good.
This is so simerlar to mine, Im not sure where I made a mistake, one thing that is different is that my cursor is done with Set Mouse Cursor on a different FSM, as I am changing the cursor type when up, over, press and paused. This is simply a blank game object with these 4 versions all with global transitions. I set them in whatever FSM using Send Event.
But thats no different to yours really, just that you are using Gui Texture, which has some pixel adjusting. As The GuiText can be moved (as I tested above) I should be able to move that in line with my approach too?

Ill be back...
Hopefully with good news!

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Re: Centering gui elements, whatever screensize.
« Reply #20 on: August 14, 2013, 07:59:59 AM »
Jean! It works! It really does! I Like Green Eggs and Ham!

but no cigar just yet..

One teensy tiny problem and a question.
My version of your thing, is on mouseOver on things (anything doors, guns, whatever) so when I rollOff I must remove the text from the screen, no problem, I just setGuiText again, but with nothing in the text field, On Idle I reset the variable from Hotween, and we should be good to go, however theres a tine flash of the text before beginning its tween again.
Heres a video so you can see what I mean.

https://www.dropbox.com/s/3cchzq9ojm7czd2/cursor%20blinking.mov

1 more question, just about the way you set up your example. You have an empty state on start that just take you to the thing... then an idle state when you are done.. I haven't got theses steps, it all happens on one state, am I moving too fast, should I add some empty states just to er... clear the air?

Mark

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Centering gui elements, whatever screensize.
« Reply #21 on: August 14, 2013, 08:43:37 AM »
Hi,

Yes, the blink is typical. You need to first set the gui text empty before you start tweening it. So simply add an intermediate state that first empty the text, and then move to the typewrite effect state.

 
Regards states: not really, that's up to you. This sample being an example, I made it so that on start it shows something straigth away, hence why I wired the start state to trigger the writing action, in a real world scenario, it's unlikely to happen. and you will somehow wait for another fsm to actually send the WRITE event.

And yes, I could have done it all into the start state, but I find that more and more I always leave the start state as clean as possible. I find it easier to expand and the START global transition doesn't get in the way then.

bye,

Jean

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Re: Centering gui elements, whatever screensize.
« Reply #22 on: August 15, 2013, 03:15:41 PM »
YEP that did it! Cheers J!!!
Beers on me... again..
M