Welcome,
Guest
. Please
login
or
register
.
May 09, 2026, 01:00:50 AM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Slider scaling problem?
« previous
next »
Print
Pages: [
1
]
Author
Topic: Slider scaling problem? (Read 6650 times)
eyali
Guest
Slider scaling problem?
«
on:
May 28, 2012, 07:23:26 AM »
HI All,
I purchased NGUI few days ago and I need slider in my game. The default scaling (200) is too small for me and according to NGUI docs one has to scale the foreground and background and not the slider container. I did scale the foreground and background to 280 (in x direction) and when I hit play in the editor the foreground re-scales back to 200 automatically...am I doing something wrong?
Please help me
Thank u in advance
Eyal
Logged
Lex
Guest
Re: Slider scaling problem?
«
Reply #1 on:
May 28, 2012, 07:52:17 AM »
You have to change the UI Sprite properties in the inspector to match the size of your background/foreground (look carefully and you'll see it, there's size X and Y and they should be set 200 and 30 for default). Note that you'll have to adjust the colliders as well and that's a lil more eyeball I guess.
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: Slider scaling problem?
«
Reply #2 on:
May 28, 2012, 11:44:07 AM »
Look for the "full size" property on UISlider.
Logged
eyali
Guest
Re: Slider scaling problem?
«
Reply #3 on:
May 28, 2012, 08:13:15 PM »
Do you mean the size panel in the Slider container?
Logged
dlewis
Guest
Re: Slider scaling problem?
«
Reply #4 on:
May 28, 2012, 09:09:15 PM »
Quote from: eyali on May 28, 2012, 08:13:15 PM
Do you mean the size panel in the Slider container?
I believe that is what he means. The X and Y in the 'size' variable must be set to the scale that the Foreground will be when they are at 100% and then it will dynamically scale based off the value.
The default slider is set to X: 200 and Y: 30. If you look at the Foreground sliced sprite and set the X scale to 200 you will see that it takes up 100% of the slider. If you want the slider longer or shorter you will need to take the scale at 100% and put that into the X/Y part in the UISlider script.
Make sure you set both X and Y. Even if you have a horizontal slider it will still scale the Y axis if it's different.
Logged
eyali
Guest
Re: Slider scaling problem?
«
Reply #5 on:
May 29, 2012, 10:59:15 PM »
Thank you for your answer
I did that. Now when playing a game the thumb doesn't move simultaneously it kind of lags after the mouse when I drag the thummb. But when the slider (both background and foreground)
are at their default values the thumb follows correctly without ant delay.
Logged
loopyllama
Guest
Re: Slider scaling problem?
«
Reply #6 on:
May 29, 2012, 11:36:46 PM »
It sounds weird, but select the root gameobject slider with the the collider and click NGUI>Attach Collider after you scale. This will update your slider's collider so the thumb moves properly.
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: Slider scaling problem?
«
Reply #7 on:
May 30, 2012, 12:29:52 AM »
Doing that puts the slider's collider above (or at the same level) as the thumb's collider, essentially intercepting the events. I'd suggest disabling the thumb's game object first before updating the collider, then re-enable it afterwards.
Logged
loopyllama
Guest
Re: Slider scaling problem?
«
Reply #8 on:
May 30, 2012, 01:19:04 AM »
Oops bad advice. ArenMook is right.
Or you can ignore both of our comments...what I MEANT to say!!! was...
select your thumb gameobject and press NGUI>Attach a Collider
that will fix your issue!
Logged
eyali
Guest
Re: Slider scaling problem?
«
Reply #9 on:
May 30, 2012, 07:38:12 PM »
Thank you all guys. It works!
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Slider scaling problem?