Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: 0xbdf on February 15, 2014, 06:48:53 PM

Title: UI Architecture - How to reduct asset duplication?
Post by: 0xbdf on February 15, 2014, 06:48:53 PM
Hey everyone!

In our game, we are using 2 UI plugins: NGUI and 2D Toolkit. Our gameplay scene uses both: NGUI for the UI/HUD (because NGUI), and 2D Toolkit for the gameplay (because performance with animations). Now, we have some assets that are used in both the UI and the Gameplay elements of that scene, and this results in a fair bit of asset duplication (between NGUI's Atlases and 2D Toolkit's Sprite Collections), which is going to grow steadily through the course of the project.

We want to stop duplicating these assets. Will you help me figure out how?

Some options we see:

Our thinking is that we can't be the only people that have run into this. What's been tried before, what's worked, what's possible that we're missing?

Thanks!
Title: Re: UI Architecture - How to reduct asset duplication?
Post by: ArenMook on February 16, 2014, 02:49:58 AM
You can use UITexture to draw just about any texture in NGUI without having to add it to an atlas. This would include what 2D toolkit uses. You can also take this one step further and create a custom widget type that pulls its data from whatever the 2D toolkit uses. This way you would have an NGUI widget using a 2D tookit's sprite. Have a look at UITexture's source code for an example. It's a pretty short class. The important function to look at is the OnFill function.