Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: DoctorWhy on August 20, 2012, 05:39:01 PM

Title: UITiledSprite 100X100 too small?
Post by: DoctorWhy on August 20, 2012, 05:39:01 PM
I have a 100x100 sprite on an Atlas that I want to be tiled.  UITiledSprite tiles it, but is giving me a warning saying "The tiled sprite is too small".  Why is 100X100 too small?  Further debugging shows that the rect.width and rect.height on lines 61-62 on UITiledSprite.cs is coming out to be 1.  I am not sure what the rect is suppose to represent, but I would assume the pixel size... so why is it 1 and not 100?  Or am I misinterpreting what those values mean?
Title: Re: UITiledSprite 100X100 too small?
Post by: ArenMook on August 20, 2012, 07:22:26 PM
100x100 is fine. 1x1 is indeed too small. Question is why are you getting the warning? Why does it believe the sprite size is 1? Without a call hierarchy, I can't answer.
Title: Re: UITiledSprite 100X100 too small?
Post by: DoctorWhy on August 21, 2012, 11:48:22 AM
Here is the call stack in the OnFill where the warning is being thrown.

  1. UITiledSprite.OnFill (verts={BetterList<UnityEngine.Vector3>}, uvs={BetterList<UnityEngine.Vector2>}, cols={BetterList<UnityEngine.Color>}) in C:\LOCATION\Assets\NGUI\Scripts\UI\UITiledSprite.cs:65
  2. UIWidget.UpdateGeometry (worldToPanel=, parentMoved=, generateNormals=) in C:\LOCATION\Assets\NGUI\Scripts\Internal\UIWidget.cs:371
  3. UIPanel.UpdateWidgets (Parameters=) in C:\LOCATION\Assets\NGUI\Scripts\UI\UIPanel.cs:757
  4. UIPanel.LateUpdate (Parameters=) in C:\LOCATION\Assets\NGUI\Scripts\UI\UIPanel.cs:891

Looking deeper, the mInner that is set in the parent class in UpdateUVs using the mSprite.inner is, of course, coming out to be 1x1, but the mSprite.outer is the 100x100. Trying to find where the inner is set to see what is going on...
Title: Re: UITiledSprite 100X100 too small?
Post by: ArenMook on August 21, 2012, 01:13:43 PM
Check the sprite itself. Select the atlas, choose the sprice. You probably set the border to some odd value. For tiled sprites it's best to set it to '1'.
Title: Re: UITiledSprite 100X100 too small?
Post by: DoctorWhy on August 21, 2012, 01:20:34 PM
Yes, that was the issue.  When I first put on the tiled sprite, you were able to see the edges.  So I changed the dimensions to 99 x 99, not knowing about the border, which automatically changed the border.  So I changed the dimensions back to 100x100, and set the border to 1, and that fixed it.  Thanks for the help.