playMaker

Author Topic: Set rect width and/or height?  (Read 3404 times)

Groo Gadgets

  • Beta Group
  • Full Member
  • *
  • Posts: 175
Set rect width and/or height?
« on: July 02, 2017, 10:23:33 AM »
Hey guys,

I would like to set the width and/or height of a rect transform.

I have downloaded the "Rect Transform Get Rect" action from the ecosystem, I would like to know if there is a "Rect Transform Set Rect" action I can use?

I've tried using the "Set Property" action but I can't find a width or height property.

Any help would be great!

Cheers,

Simon

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set rect width and/or height?
« Reply #1 on: July 03, 2017, 02:45:31 AM »
Hi,

 for this you need to use the dedicated RectTransform actions.


namely "SetSizeDelta" which will affect width and heigh

you need to be very careful with the rectTransform values because the anchoring presets will use the rect values differently.

Bye,

 Jean

Groo Gadgets

  • Beta Group
  • Full Member
  • *
  • Posts: 175
Re: Set rect width and/or height?
« Reply #2 on: July 03, 2017, 08:03:49 AM »
Ahh thank you so much Jean! I was confused since I was looking for a width or height action.

I'm actually using this action to build an expandable menu system. I can't do it without this action.  ;D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Set rect width and/or height?
« Reply #3 on: July 04, 2017, 02:31:34 AM »
Hi,

 actually you can, you can change anchoring and then your system will adapt to all screen size and ratios. So make sure you fully read on rectransform and experiment with it, because animating pixels may backfire when you'll need to support various screensizes.

Bye,

 Jean