Author Topic: Changing texture not updating  (Read 9248 times)

ranilian

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
    • Industry Corporation
Changing texture not updating
« 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.

PhilipC

  • Guest
Re: Changing texture not updating
« Reply #1 on: September 20, 2012, 04:22:11 PM »
To confirm you are using the UITexture.mainTexture to set the new texture correct?

ranilian

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
    • Industry Corporation
Re: Changing texture not updating
« Reply #2 on: September 20, 2012, 04:33:50 PM »
Yep.

PhilipC

  • Guest
Re: Changing texture not updating
« Reply #3 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.

ranilian

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
    • Industry Corporation
Re: Changing texture not updating
« Reply #4 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.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Changing texture not updating
« Reply #5 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?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Changing texture not updating
« Reply #6 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Changing texture not updating
« Reply #7 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.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Changing texture not updating
« Reply #8 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. :)