- Home /
UI Fading in flicker 5.5
I'm trying to make this RectTransform fade in. It has an script which controls the alpha value of the canvas renderer of it and its children as detailed by http://answers.unity3d.com/questions/780323/unity-ui-fading-canvaspanel.html
so using this script I have done the following:
Set RectTransform as inactive
Activate RectTransform with Alpha set to 0 in start function.
Animate the Alpha variable to go from 0 to 1.
between steps 1 and 2 it seems like it takes a little to realize that it has to set Alpha to 0 and so it creates this flicker which I don't like. My guess is that the canvasrenderer takes a frame to run the start function causing this. ¿Any ideas on how to tackle this issue?
Answer by hexagonius · Mar 19, 2017 at 10:35 AM
had this too. Call Canvas.ForceUpdateCanvases()
after initializing the values.
https://docs.unity3d.com/ScriptReference/Canvas.ForceUpdateCanvases.html
Or set them in Awake.
It seems like that was it! thanks. Setting them in awake worked perfectly, the other function also worked but I think that the awake method is way more useful for my purposes.