Author Topic: UITexture doesn't repainting  (Read 2299 times)

PoN

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 111
    • View Profile
UITexture doesn't repainting
« on: February 17, 2014, 02:53:50 AM »
Hi Aren, I use UITexture with material which has my own shader, then i change params , like these :

  1. material.SetColor("_BrdColor",....
  2. material.SetColor("_BGColor",...
  3. material.SetColor("_FGColor",...
  4.  

but UITexture not update or not repainting , and only repainting (display with new params) when i click on UIInput or click on UIPopupList or just disable-enable UITexture component, why? what'w wrong?

P.S. that had been coming from NGUI 2.7 vers.
« Last Edit: February 17, 2014, 03:26:30 AM by PoN »
Worked on Doc&DogAge Of Fury 3D. Actually working on WarMach.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UITexture doesn't repainting
« Reply #1 on: February 17, 2014, 11:16:46 AM »
NGUI makes a copy of the material. Use texture.drawCall.dynamicMaterial.SetColor instead.

PoN

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 111
    • View Profile
Re: UITexture doesn't repainting
« Reply #2 on: February 17, 2014, 09:15:16 PM »
yes, it's work, but,but ,but..have found new bug, if i have changed "params" that UITexture has repainted and then if i tap/click on UIInput widget on a same panel, that UITexture "params" is reset to initial "params" .
Worked on Doc&DogAge Of Fury 3D. Actually working on WarMach.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UITexture doesn't repainting
« Reply #3 on: February 18, 2014, 10:05:38 AM »
Without knowing how your UITexture is used I can't tell you why an input field would affect it, but I suppose you can also just set the color on both the material and the dynamic material.

Also, I'd suggest you not use material properties if you can simply use shader globals (Shader.SetGlobalColor).