Support => NGUI 3 Support => Topic started by: kjenkins_oculus on November 01, 2013, 07:04:34 PM
Title: UITexture only changes texture on first instance of prefab
Post by: kjenkins_oculus on November 01, 2013, 07:04:34 PM
I have a prefab with a UITexture. I instantiate it 4 times. On each of the 4 instances I call a script on the prefab to change the texture using the WWW class and a URL.
Each of the 4 instances downloads the texture, then runs the code to change it.
However, the first texture changes 4 times in quick succession, while the other 3 remain black. Through breakpoints I have confirmed that each of the 4 instances is downloading its own texture. It's like the material or texture is shared among all instances when it should not be.
Thanks for the help.
Title: Re: UITexture only changes texture on first instance of prefab
Post by: kjenkins_oculus on November 01, 2013, 07:09:22 PM
I tried setting the texture to nothing as specified in this thread http://www.tasharen.com/forum/index.php?topic=3613.msg17836#msg17836
It did not fix the problem. Doing that only displays the "Color Tint" value.
Title: Re: UITexture only changes texture on first instance of prefab
Post by: ArenMook on November 01, 2013, 08:25:10 PM
UIWidget.drawCall.dynamicMaterial is what you should be altering. Texture material is only what the drawn material gets created from.
Title: Re: UITexture only changes texture on first instance of prefab
Post by: kjenkins_oculus on November 04, 2013, 01:47:00 PM
UIDrawCall does not have a member dynamicMaterial.
Title: Re: UITexture only changes texture on first instance of prefab
Post by: kjenkins_oculus on November 04, 2013, 01:57:50 PM
I found the problem, it was not nGUI. I was using a string based callback but every instantiated game object had the same name.