Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Nicki on May 17, 2017, 07:43:02 AM

Title: Teensy bug in UIGrid with Smooth Tween
Post by: Nicki on May 17, 2017, 07:43:02 AM
If you have say 9 elements in your grid, and you set the pivot to center (non-TopLeft) and use the Smooth Tween option on the grid, the first element will be put instantly in the Top Left corner.

It looks to be that it measures whether a SpringPosition should be used, before it applies the origin offset.

The quick and dirty fix is to remove the SqrMagnitude check in UIGrid.cs:371 which means the center element will tween from 0,0,0 to 0,0,0, so not a terrible loss.
Title: Re: Teensy bug in UIGrid with Smooth Tween
Post by: ArenMook on May 19, 2017, 05:10:45 AM
Hey Nicki! It's line 380 here. Would this work then?
  1. if (animateSmoothly && Application.isPlaying && (pivot != UIWidget.Pivot.TopLeft || Vector3.SqrMagnitude(t.localPosition - pos) >= 0.0001f))