Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Mazyod on August 01, 2016, 03:16:57 AM

Title: NGUI 3.10.0 Bugs
Post by: Mazyod on August 01, 2016, 03:16:57 AM
Hi,

I've just upgraded to the latest NGUI, and was doing a quick code review.. I'll list my findings here:

1. BlackBerry bug:
The original implementation was using #else, so the if statement was always executed. With the new implementation, non of the if statements are compiled on unity 5.4, so the assignment code "value = ..." is always executed, which doesn't seem right.

      // BB10's implementation has a bug in Unity
#if UNITY_4_3
      if (Application.platform == RuntimePlatform.BB10Player)
#elif UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3
      if (Application.platform == RuntimePlatform.BlackBerryPlayer)
#endif
         value = value.Replace("\\b", "\b");

To fix this, you can do:

      // BB10's implementation has a bug in Unity
#if UNITY_4_3
      if (Application.platform == RuntimePlatform.BB10Player)
         value = value.Replace("\\b", "\b");
#elif UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3
      if (Application.platform == RuntimePlatform.BlackBerryPlayer)
         value = value.Replace("\\b", "\b");
#endif

Incidentally, this is why I never write if statements without braces. It would be good practice if you always include braces in your code.


... Well, that was it, really. Just one issue.

Thanks,
Maz
Title: Re: NGUI 3.10.0 Bugs
Post by: ArenMook on August 01, 2016, 06:22:57 AM
While you can certainly put it in the brackets, leaving it out shouldn't cause any issues. It just means any encounter of \ followed by b will be replaced with a \b symbol (backspace). I wouldn't call it a bug, let alone bugs, plural.