playMaker

Author Topic: GUI Pixel Width / Height  (Read 2206 times)

Horror

  • Junior Playmaker
  • **
  • Posts: 79
GUI Pixel Width / Height
« on: June 24, 2012, 12:43:09 AM »
Hey everyone!

I've been looking around for a way to change a GUI Texture's pixel width over time. Are there any play maker actions that can handle this? I basically have a power-up bar and I want it to shrink as the power-up duration runs down.

Cheers!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: GUI Pixel Width / Height
« Reply #1 on: June 25, 2012, 01:33:25 AM »
Hi,

 you can use FsmObject and set property to access the pixelInset and set its width like so.

1: create a "object" variable in your fsm.
2:select UnityEngine/GuiTexture" for its type
3: drag the guitexture on it to reference it

4: in your state use the action "set property" targeting that "object" variable and set its property "PixelInset".

PixelInset is a rect, so maintain also a rect variable, and change the width of the rect and inject that using set property in step 4.

 hope this helps.

also check http://hutonggames.com/playmakerforum/index.php?topic=1023.0

that action could be what you want too

 Jean

Horror

  • Junior Playmaker
  • **
  • Posts: 79
Re: GUI Pixel Width / Height
« Reply #2 on: June 25, 2012, 03:35:27 AM »
Jean, you are a well of information  ;D

I'm a bit confused on how to manage a rect variable, though. The Rect section of PixelInset only allows me to set an initial value, but not a variable. So how do I update the object? I was hoping I could just use an integer to define pixel width and apply that to the X field of the Rect.

I'll try messing around with that health action next if I can't get this to work, but I'd like to solve it without custom actions if possible.

Thanks!