Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: N3uRo on October 27, 2014, 02:27:43 PM

Title: NGUI and Unity 5.0 Upgradable APIs
Post by: N3uRo on October 27, 2014, 02:27:43 PM
Aren can you fix this? I mean change all the "shortcuts" of Monobehaviour to "GetComponent<T>()".

And you can get rid of mTrans because they say that internally they cache transform component.

Thanks!!

http://unity3d.com/unity/beta/5.0
Title: Re: NGUI and Unity 5.0 Upgradable APIs
Post by: Meltdown on October 27, 2014, 06:39:18 PM
+1, would love to see this in the next update.
Title: Re: NGUI and Unity 5.0 Upgradable APIs
Post by: Nicki on October 27, 2014, 08:14:06 PM
Changing whatever shortcuts are used should be a simple change, but removing cachedTransform will likely slow things down for everything but 5.0 where it doesn't cache properly and performs a getcomponent every time.
Title: Re: NGUI and Unity 5.0 Upgradable APIs
Post by: bdominguez on October 28, 2014, 10:00:35 AM
Changing whatever shortcuts are used should be a simple change, but removing cachedTransform will likely slow things down for everything but 5.0 where it doesn't cache properly and performs a getcomponent every time.

In "SCRIPTING FEATURES"

"“transform” is now cached on the C# side, no more need to cache it yourself."

http://unity3d.com/unity/beta/5.0/release-notes
Title: Re: NGUI and Unity 5.0 Upgradable APIs
Post by: bac9 on October 28, 2014, 11:01:35 AM
In "SCRIPTING FEATURES"

"“transform” is now cached on the C# side, no more need to cache it yourself."

http://unity3d.com/unity/beta/5.0/release-notes

That's exactly his point, performance for everyone but 5.0 users will degrade if that change will be done right now.
Title: Re: NGUI and Unity 5.0 Upgradable APIs
Post by: BeShifty on October 28, 2014, 01:26:10 PM
Unity 5 will automatically rewrite references to .particleSystem, .collider, etc to the GetComponent<T> version when you upgrade your project. That won't help when you need to update to a new version of NGUI though (if NGUI is still using .collider). I would say Aren should run his NGUI project through a Unity 5 upgrade now (since GetComponent<Collider>() is no worse than .collider) but leave the caching of transforms until Unity 5.1 or a time when the majority of users are on Unity 5.
Title: Re: NGUI and Unity 5.0 Upgradable APIs
Post by: Wisteso on October 28, 2014, 11:33:53 PM
Why not just use both approaches and wrap the code with platform dependent compilation macros like... #if UNITY_5_0

It will be a little ugly but it should work.
Title: Re: NGUI and Unity 5.0 Upgradable APIs
Post by: ArenMook on October 29, 2014, 05:24:09 AM
After you import the NGUI's update, Unity 5 will automatically auto-upgrade everything for you. I've made NGUI Unity 5 compatible more than a month ago.
Title: Re: NGUI and Unity 5.0 Upgradable APIs
Post by: bdominguez on October 29, 2014, 06:44:18 AM
After you import the NGUI's update, Unity 5 will automatically auto-upgrade everything for you. I've made NGUI Unity 5 compatible more than a month ago.

And everytime we want to start a new project we have to import NGUI and "auto upgrade"?? That doesn't make any sense.

There could be places in NGUI where you use some "shortcut" in Update/LateUpdate/FixedUpdate and it's going to replace it to "GetComponent<T>()" and it's not being cached with "mComponent = GetComponent<T>()" in Awake/Start