Author Topic: Force Update of clipping Texture  (Read 2072 times)

Brian_C

  • Guest
Force Update of clipping Texture
« on: November 09, 2012, 11:29:12 AM »
Hiya :)

I'm having trouble when I instantiate and show a UITexture during the Unity Start() function.

The UITexture is under a UIPanel that has soft clipping enabled, however when the texture renders it is entirely white. If I check the material in the inspector the image is there so I'd expect.

There is also a UIDraggable object on the texture (with all the other draggable scripts in the hierarchy) and if I drag the texture entirely outside of the clipping range and back in then the texture displays without a problem. Also, if I deactivate the texture and reactivate it then it displays fine.

Is there any way of updating the drawing of the UITexture to mimic the action of showing and hiding the texture, or something similar? Or else is there a way to debug what might be happening with the UITexture?

Just after the UITexture is instantiated the image is loaded from the Resources folder and assigned to the UITexture so if I had to guess I'd say that the shader is not updating correctly due to some timing issue.

Thanks for reading this, and I hope you have a good weekend.
Brian :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Force Update of clipping Texture
« Reply #1 on: November 09, 2012, 05:38:04 PM »
Sounds strange. So in your Start() function you just assign the "mainTexture" value of the UITexture, and it shows up as white? What shader is it using?

Clipping won't work unless you use "Unlit/Transparent Colored" shader (it should be automatically replaced with Unlit/Transparent Colored (SoftClip)"