Author Topic: Scaling buttons  (Read 4121 times)

Azura

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Scaling buttons
« on: April 03, 2014, 11:34:33 AM »
Hi guys, currently I'm trying to build a menu where the buttons scale [Tween Scale Script] in from 0-1 when we set them to spawn. We have that working, but I'd also like the button to scale up OnClick, so I tried to add the UIButton Scale component.

Unfortunately, when I now hover over my button it disappears - almost as though the Tween Scale is reversing from 1-0.

Is the UIbutton scale dependent on the TweenScale? How can I stop it doing this?

« Last Edit: April 03, 2014, 11:39:52 AM by Azura »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scaling buttons
« Reply #1 on: April 03, 2014, 09:24:43 PM »
Zero is invalid scale. Can't divide by zero.

Erbacher

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: Scaling buttons
« Reply #2 on: April 04, 2014, 05:35:48 AM »
Hi Aren,

Even if the Tween Scale is set to 0.1, the same problem is occurring.



When you hover over the sprite/button you will notice that the sprite scales back down to that 0.1 size set in Tween Scale. It seems that the UIButton Scale is making the Tween Scale component scale the sprite back to the From size.

I noticed that even if you disable the Tween Scale component after the animation is complete. UIButton Scale's Hover does still not work correctly?

This is what happens to Tween Scale when you hover over the sprite:



Is there a better way for us to have both Tween Scale and UIButton Scale working without colliding with each other?

Thanks for your time.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scaling buttons
« Reply #3 on: April 04, 2014, 10:18:59 PM »
Wait, why do you have both Tween Scale and UIButtonScale?

UIButtonScale creates TweenScale for you. You don't need to attach TweenScale. If you want to set up your tween using TweenScale beforehand, then set it up, leave the component disabled, and use UIPlayTween to trigger it instead.

Azura

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Scaling buttons
« Reply #4 on: April 07, 2014, 09:45:43 AM »
Wait, why do you have both Tween Scale and UIButtonScale?

UIButtonScale creates TweenScale for you. You don't need to attach TweenScale. If you want to set up your tween using TweenScale beforehand, then set it up, leave the component disabled, and use UIPlayTween to trigger it instead.

I wanted 2 scale tweens to play on the same object at separate times - once when it scales in on the screen when you start it up [hence the tween scale] and then also a slight scale when you click the button [hence trying to add the ButtonScale]

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scaling buttons
« Reply #5 on: April 07, 2014, 10:14:21 PM »
Put them on separate objects. They conflict with each other. Button scale overwrites the tween scale, completely destroying your values.