Search Unity

When does UI image refresh after changing a material property?

Discussion in 'UGUI & TextMesh Pro' started by ryancampfire, Oct 16, 2019.

  1. ryancampfire

    ryancampfire

    Joined:
    Jan 4, 2017
    Posts:
    31
    I have a bunch of buttons for items, but you can also set the colour of those items. So I want to show the current colour on these item buttons.

    So I gave these buttons' images a material, and changing colour changes the colour of that material. ( with .SetColor() )

    I find you don't see the change right away, the colour on the item buttons stays the same.

    It will update if you disable and re-enable the parent of the buttons. I tried LayoutRebuilder.MarkLayoutForRebuild but that doesn't seem to include the Image materials.

    When does the Image refresh after changing a material property? And how can I force that to refresh when I want?
     
    Last edited: Oct 16, 2019
  2. ryancampfire

    ryancampfire

    Joined:
    Jan 4, 2017
    Posts:
    31
    I tried a few things but for now I'm doing the disable / re-enable.