Author Topic: Problem in UISprite in case of tiled sprite type  (Read 4015 times)

dkozlovtsev

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 35
    • View Profile
Problem in UISprite in case of tiled sprite type
« on: August 14, 2013, 06:48:48 AM »
Hello,
I have encountered a problem with UISprite.
When tiled sprite fits into UISprite more than 100 times by one of the dimentions, induvidual tiles are being scaled to 1:1 width to height ratio.
and the following warning message appears in unity log:
  1. The tiled sprite ("UI Root (2D)/MenuCamera/MainMenu/Panel/Sprite") is too small.
  2. Consider using a bigger one.
  3. UnityEngine.Debug:LogWarning(Object)
  4. UISprite:TiledFill(BetterList`1, BetterList`1, BetterList`1) (at Assets/Packages/NGUI/Scripts/UI/UISprite.cs:1073)
  5. UISprite:OnFill(BetterList`1, BetterList`1, BetterList`1) (at Assets/Packages/NGUI/Scripts/UI/UISprite.cs:535)
  6. UIWidget:UpdateGeometry(UIPanel, Boolean) (at Assets/Packages/NGUI/Scripts/Internal/UIWidget.cs:697)
  7. UIPanel:LateUpdate() (at Assets/Packages/NGUI/Scripts/UI/UIPanel.cs:1074)
  8.  

Is it a bug or intended behavior, if it is intended could you please elaborate why is it so?
UPDATE:
looked into UISprite:TiledFill
This is happening because of this condition
  1. // Safety check. Useful so Unity doesn't run out of memory if the sprites are too small.
  2. if (width < 0.01f || height < 0.01f)
  3. {
  4.         Debug.LogWarning("The tiled sprite (" + NGUITools.GetHierarchy(gameObject) + ") is too small.\nConsider using a bigger one.");
  5.         width = 0.01f;
  6.         height = 0.01f;
  7. }
  8.  
as you can see if either one of width or height is less than 0.01 both are forced to 0.01 which seems to be a mistake


« Last Edit: August 14, 2013, 07:12:11 AM by dkozlovtsev »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem in UISprite in case of tiled sprite type
« Reply #1 on: August 15, 2013, 07:30:53 AM »
That's intentional. You're generating too much geometry.

100*100*4 = 40,000 vertices. The absolute per-drawcall cap is 64,535.

Do what NGUI tells you -- use a bigger sprite. ;)

dkozlovtsev

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 35
    • View Profile
Re: Problem in UISprite in case of tiled sprite type
« Reply #2 on: August 15, 2013, 11:33:22 AM »
Thanks!

dkozlovtsev

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 35
    • View Profile
Re: Problem in UISprite in case of tiled sprite type
« Reply #3 on: August 16, 2013, 03:38:36 AM »
Wouldn't it be better to limit total number of tiles allowed and not tiles allowed per one of the dimension?
for example 101x1 tiling would result in 404 vertices and it is not allowed, but 50x50 tiling would result in 10k vertices and NGUI is fine with it.

Sorry for double-posting  :-\

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem in UISprite in case of tiled sprite type
« Reply #4 on: August 17, 2013, 01:21:07 AM »
True.

dkozlovtsev

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 35
    • View Profile
Re: Problem in UISprite in case of tiled sprite type
« Reply #5 on: August 19, 2013, 02:44:32 AM »
Will it be fixed in subsequent releases?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem in UISprite in case of tiled sprite type
« Reply #6 on: August 19, 2013, 09:03:50 AM »
Already in 2.6.5.