Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - nekokiller

Pages: [1]
1
NGUI 3 Support / Re: Unity 5.2 crash (focus/save)
« on: November 04, 2015, 12:55:57 AM »
ngui 3.9.2 + unity 5.2.2p2 , work fine.

seems unity 5.2.2p2 fixed this crash problem. 

2
NGUI 3 Support / Re: Unity 5.2 crash (focus/save)
« on: October 02, 2015, 01:16:14 AM »
Unity 5.2.1 + NGUI 3.9.2

always crash on save scene.

now fixed!

you have to fix the UILable.cs of UGUI 3.9.2

line 1139 : #if !UNITY_4_3 && !UNITY_4_5 && !UNITY_4_6

modified to : if !UNITY_4_3 && !UNITY_4_5 && !UNITY_4_6 && !UNITY_5



but there was another problem of using dynamic font on UILabel. ( I think it is bug of NGUI 3.9.2 )

so we also according to NGUI 3.8.0 and fix the code of UILabel 3.9.2 about the dynamic font delegate process 



3

UIDraggableCamera.cs : ConstrainToBounds( ) :  if ( offset.magnitude > 0f )

UIScrollView.cs : RestrictWithinBounds( ) : if (constraint.magnitude > 1f )

UIPanel.cs : ConstrainTargetToBounds()

SpringPosition.csd : Update( ) :    use sqrMagnitude can do the same result, just have to modify some codes.



4
thanks for reply.

we are not just replace the 'magnitude', of couse we have to modify relative codes to make the logic right.

Vector3.sqrMagnitude :  Returns the squared length of this vector

If you just want to check the distance is bigger or smaller than a constant value, not to get a real distance , you really really should use sqrMagnitude instead of magnitude for the performance issue.

The reason for using sqrMagnitude instead of magnitude is because magnitude has to do a square root operation, which is pretty expensive, much more so than a multiplication.


example :

UICamera.cs : void ProcessTouch( ... )
...
float mag = currentTouch.totalDelta.magnitude;
...
if ( currentTouch.delta.magnitude != 0f )
...

example :

LookAtTarget.cs : LateUpdate() :
...
float mag = dir.magnitude ;
if(mag > 0.001f )
...



change to currentTouch.delta.sqrMagnitude is not better ?  of course the sqrMagnitude is better than magnitude.


other examples in
UIDragObject.cs, UIWidget.cs, UIScrollView.cs



5
NGUI 3 Support / use Vector3.sqrMagnitude instead of Vector3.magnitude
« on: March 11, 2014, 10:53:47 AM »
hi, ngui team:

You should use the Vector3.sqrMagnitude instead of Vector3.magnitude.

Our program with ngui , the performance is not good  on the android/ios device . ( our case, we got fps = 40 ~ 45 )

We change the ngui source code , use sqrMagnitude instead of magnitude , then the performance is become good a lot ~ ( fps up to 50 ~ 55 )


Pages: [1]