Author Topic: How do you stretch an UISlider?  (Read 2118 times)

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
How do you stretch an UISlider?
« on: June 21, 2013, 01:05:21 AM »
Hello, not quite sure why I am problems with this. Must be doing something wrong.

Ok, I have an energy bar using UISlider that has a length of about 200 pixels.

I want the energy to increase in length, for example to 300 pixels. But the UIValue "Value" slider from 0-1 is locked to 0-200.

I can modify the background image to stretch it to 300 but can't do it with the foreground image.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How do you stretch an UISlider?
« Reply #1 on: June 21, 2013, 02:57:49 AM »
It uses whatever value the sprite started with. Resize the foreground sprite at edit time. If you need to modify this value in play time, look at UISlider.fullSize.

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: How do you stretch an UISlider?
« Reply #2 on: June 21, 2013, 04:37:50 AM »
Doh, that is pretty embarrassing.

I even looked through the source and saw

public Vector2 fullSize { get { return mSi.............

but since I was skimreading I didn't read any further into the line and see the "set" command. DOH! I think I need some sleep.

Cheers ArenMook. :)