Raw image flickering when texture changed
I am running into this weird issue where updating texture of a raw image causes the texture to flicker (you know like the old movies, where there would be a flicker between frames).. any suggestion?
Answer by glitchers · Aug 29, 2017 at 04:31 PM
I had this same issue and I've found the cause and implemented a work around.
I noticed this issue when using an Animation
to change the RawImage.texture
which caused the whole RawImage
to flicker. This is not noticeable I think when you are using RawImage
with no shaders / animations / uv changes etc as for this 1 frame a new material instance is created which doesn't have the values copied over.
I have the IMaterialModifier
on my class which uses the Animator
. I added a break in the GetModifiedMaterial
function and it would stop every time I set RawImage.texture
. I was able to mitigate this issue by not using the texture
attribute of the RawImage
and updated my shader to use a texture that is passed to it via a script ( material.SetTexture("workaroundTex", tex)
) and it works now without a flicker.
I know this is not an ideal solution as it renders the inspector for the RawImage
less useful but it worked for me so I thought I would share as this is the top result on Google currently. Hopefully someone else can find this useful.