Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: kajed on August 06, 2013, 02:51:50 PM

Title: Best way to have a second additive material (UIAtlas)
Post by: kajed on August 06, 2013, 02:51:50 PM
I was wondering what the best way to create a second material that can easily be assigned to any given UISprite that will use an additive shader for the material.

I just want to be able to draw an additive version on top of a regular sprite. I also don't want to have to ever update the second material (just uses the original sheet anyways).
Title: Re: Best way to have a second additive material (UIAtlas)
Post by: ArenMook on August 07, 2013, 05:16:43 AM
Just create a copy of an existing one and change its shader.
Title: Re: Best way to have a second additive material (UIAtlas)
Post by: kajed on August 07, 2013, 05:50:33 AM
That doesn't really work.  You can clone the material and make it additive but a UISprite has no way to just assign a material, you have to assign a UIAtlas WITH a material. If you clone the atlas itself and point to the same material then you now have to make sure BOTH atlasses stay correctly up to date (ie: duplicate and modify the original every time you add / remove from the sheet).
Title: Re: Best way to have a second additive material (UIAtlas)
Post by: ArenMook on August 07, 2013, 05:52:48 AM
Yes, you have to replace the material on the atlas. Are you trying to affect only 1 sprite on the screen? If that's the case, then you have to use a UITexture here instead of a sprite. That lets you choose a material.
Title: Re: Best way to have a second additive material (UIAtlas)
Post by: kajed on August 07, 2013, 05:54:43 AM
The sprite I want to use is already on a sheet, and SHOULD stay on that sheet.

It would be nice to see a feature allowing us to override the shader on any given UISprite.
Title: Re: Best way to have a second additive material (UIAtlas)
Post by: ArenMook on August 07, 2013, 05:56:52 AM
The upcoming UI system will let you do that. I doubt I'll be changing NGUI to allow this, however.
Title: Re: Best way to have a second additive material (UIAtlas)
Post by: kajed on August 07, 2013, 06:02:01 AM
Well that's just downright mean! I guess I'll just have to make due with updating the second atlas.

There's a new UI Asset in the works?
Title: Re: Best way to have a second additive material (UIAtlas)
Post by: ArenMook on August 07, 2013, 06:02:39 AM
Built-in solution for Unity. I work at Unity Technologies.
Title: Re: Best way to have a second additive material (UIAtlas)
Post by: kajed on August 07, 2013, 06:04:07 AM
I'm not sure if I should be excited for a built in UI system or sad that something might replace NGUI.  Especially given it's unlikely we'll change mid project.
Title: Re: Best way to have a second additive material (UIAtlas)
Post by: ArenMook on August 07, 2013, 06:04:55 AM
There is still a while to go until it's ready.
Title: Re: Best way to have a second additive material (UIAtlas)
Post by: galuodo on August 07, 2013, 11:34:14 AM
Our project also encountered this problem, I use the UITexture instead.