Author Topic: Division by zero in UIWidget DrawingDimensions when Alpha = 0  (Read 2676 times)

FriedrichWessel

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Division by zero in UIWidget DrawingDimensions when Alpha = 0
« on: January 24, 2014, 06:27:28 AM »
Hello,

I just encountered a problem with the BoxColliders on a Widget that starts with an alpha of zero. To reproduce:
1. Create A Widget with an alpha Tween and a BoxCollider
2. Set WidgetColor Alpha to Zero
3. Change a script so Unity Recompile
4. BoxCollider now have Dimension of NaN and size of NaN which causes Unity Error: dist.radius >= 0

Problem is located here:
NGUITools.cs:281 : UpdateWidgetCollider uses the drawDimensions of the Widget ( UIWidget:397 ) which get NaN if the Widget is not visible because width and height are zero.
I just add a work-around for me and catch the NaN in the NGUITools - but would be nice if there is a less dirty solution in the next NGUI Version.

Best regards Friedrich Wessel
Using Unity 4.2, Windows 8, NGUI: 3.0.7 f3

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Division by zero in UIWidget DrawingDimensions when Alpha = 0
« Reply #1 on: January 24, 2014, 08:12:23 AM »
This was already fixed. You should always update to the latest version before posting about issues.