Author Topic: UIStretch Styles...  (Read 2523 times)

Zodd

  • Guest
UIStretch Styles...
« on: September 20, 2013, 04:17:47 PM »
I can't seem to find a scaling style that works properly with an object anchored to the bottom of the screen. All I want is for an object to maintain it's ratio and scale both vertically and horizontally with the screen resolution, so that the object remains flush with the screen. I feel like I must be doing something wrong, because none of the styles produce those simple desired results. Most of them stretch my object all out of scale and make it far too large for the screen. The one that seems to work the best is FitInternalKeepingRatio, but the problem with that is the sprite is no longer anchored to the true bottom of the screen and instead, a bit lower, causing the object to be cutoff at certain resolutions.

Here's a step by step process of what I do:
With build settings set to the android platform and the game window set to 320x480 Portrait:
1. Create all the UI stuff, anchor, panel, etc.
2. Change the anchor settings to "Bottom"
3. Create a sprite in the panel, which consists of a checkered game board.
4. On the sprite object adjust the scaling so that the sides of it are flush with the game window.
5. On the sprite object adjust it's vertical orientation is flush with the bottom of the screen.
6. Attach UIStretch to sprite object.
7. Try a style.
8. Hit play.
9. Delete non-working sprite (due to that my scaling is completely and permanently messed up by most of these styles).
10. Repeat with other potential styles.

I have done no more than any of this, thus every other setting would be a default.

Where's the flaw? Thanks!
« Last Edit: September 20, 2013, 04:26:10 PM by Zodd »

Zodd

  • Guest
Re: UIStretch Styles...
« Reply #1 on: September 20, 2013, 04:31:57 PM »
I always find solutions right after posting lol. So I basically just attached the UIStretch script to the parent panel and set it to FitInternalKeepingRatio and it seems to work as desired now ^_^

sonicviz

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 58
    • View Profile
Re: UIStretch Styles...
« Reply #2 on: October 10, 2013, 11:14:52 PM »
I always find solutions right after posting lol. So I basically just attached the UIStretch script to the parent panel and set it to FitInternalKeepingRatio and it seems to work as desired now ^_^

How does this work?

Arenmook posted previously that UIStretch is for use on widgets?
UIStretch is meant to go on the individual widgets, and cannot be placed on the container game objects.

Your UI is going to be challenging to do with NGUI. Main reason being the whick non-tileable borders, and the interlaced (again non-tileable) background on the UI elements.

If you are really set on this kind of look, your best bet is to split it up into as many "lego-like" components as possible, or you will end up using a ton of texture memory.

I tried UIStretch on a a panel with widgets and it went crazy, everything was repositioned all over the place.
« Last Edit: October 10, 2013, 11:37:59 PM by sonicviz »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIStretch Styles...
« Reply #3 on: October 11, 2013, 07:49:17 AM »
UIStretch on panels is a feature in either 3.0.2, or the latest pro version (which will become 3.0.3) -- I don't remember which. But stretch works on panels in the current pro version.