Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: ranilian on September 20, 2012, 03:17:50 PM

Title: Changing texture not updating
Post by: ranilian on September 20, 2012, 03:17:50 PM
Hey,

I have a UITexture that updates it's mainTexture element every now and then, now the Texture field in the Inspector under the UITexture script updates to the new texture however it draws the old texture in game.

The panel has a hardclip. What I noticed is that whenever I disable/enable the UITexture it updates the drawn texture.
Title: Re: Changing texture not updating
Post by: PhilipC on September 20, 2012, 04:22:11 PM
To confirm you are using the UITexture.mainTexture to set the new texture correct?
Title: Re: Changing texture not updating
Post by: ranilian on September 20, 2012, 04:33:50 PM
Yep.
Title: Re: Changing texture not updating
Post by: PhilipC on September 20, 2012, 06:26:32 PM
I'm not 100% sure the reason by try doing a panel.refresh after it should fix the issue i think.
Title: Re: Changing texture not updating
Post by: ranilian on September 20, 2012, 06:35:22 PM
Nope. Does not help. It doesn't seem to refresh the actual UITexture children, unless I disable/enable them.
Title: Re: Changing texture not updating
Post by: Nicki on December 04, 2012, 10:07:04 AM
This issue plagues me as well.

I change the uitexture's mainTexture, but it's never updated on screen.

I've tried to do stuff to jolt it, such as "MarkAsChanged()" and getting the UIPanel to refresh, but to no avail. Any hints?
Title: Re: Changing texture not updating
Post by: Nicki on December 04, 2012, 10:08:45 AM
When I look at the material on the UITexture and watch it in the editor it changes fine out there, it just doesn't update on screen at all.
Title: Re: Changing texture not updating
Post by: ArenMook on December 04, 2012, 10:12:13 AM
When in doubt -- debug it. I can't help atm. KLM lost my luggage and my laptop is dying.
Title: Re: Changing texture not updating
Post by: Nicki on December 04, 2012, 10:13:31 AM
Sorry for the comment spam.

I think I got this just after I posted. I've been debuggin for a while now. :P

 It's because the UITexture had a material assigned instead of a texture, so it changed the texture in the material, but not on screen.

When I remove the assigned material and assign nothing in the prefab and set a texture to mainTexture in code it updates fine.

Sorry about your luggage! I hope you enjoy your stay in DK in any case. :)