Author Topic: Changing Material of UI2dSprite or UITexture At Runtime  (Read 3565 times)

aliasif452001

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Changing Material of UI2dSprite or UITexture At Runtime
« on: April 27, 2016, 10:52:46 AM »
Hello . I am trying to change and alter material of ui2dsprite and UItexture during runtime . It seems normal UItexture.material doesn't work i tried access UItexture.DrawCall.basematerial but it gives me null exception  . I can not think of any other way to do this . Any idea how i can do that ?

Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Changing Material of UI2dSprite or UITexture At Runtime
« Reply #1 on: April 28, 2016, 02:32:17 AM »
Set the sprite's onRender delegate. When it's called, it will pass a Material that you can then do what you want to that material.

aliasif452001

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Changing Material of UI2dSprite or UITexture At Runtime
« Reply #2 on: April 29, 2016, 01:56:05 PM »
Thanks it worked