- Home /
Unity 5.2 Canvas.RenderOverlays serious fps hit
Hello. To fade in/out (cinematographic effect, when the screen smoothly turns black) the screen I use Canvas with black image on it, and smoothly lerp CanvasGroup Alpha value over time. Updated Unity to 5.2 just now and this system turned into a massive performance hit.
As you may see, that purple spikes represent FadeIn and FadeOut. Game plays like in slide-show during this translations. I had read over Upgrade Guide but foud nothing helpful...
Ins$$anonymous$$d of messing with the canvas' alpha, lerp the image's color property to/from full-alpha and see if that helps.
Tried it just now. Result is the same :( I'll try to use Sprite overlay ins$$anonymous$$d of UI.Image. $$anonymous$$ay be that will help.
Answer by Deadcow_ · Oct 16, 2015 at 07:28 AM
Okay, I still don't know how to deal with huge images dynamic transparency (which is causing the hit) but in my case just had replaced UI.Image with Sprite and all went fine
Edit: Fixed in 5.3.6: https://issuetracker.unity3d.com/issues/waitingforjob-spike
Here is the bug report, fixed on Unity version 5.3.6 https://issuetracker.unity3d.com/issues/waitingforjob-spike
Answer by Pundek · Oct 03, 2015 at 02:37 PM
I've the same problem here....
Here is the script that i use to change the alpha of a canvasgroup:
private IEnumerator GoInCanvasEffect(CanvasGroup _canvasgroup, float _alphaSpeedFactor = 1f, bool _interactable = true, Selectable _nextButton = null)
{
#region GO IN CANVAS GROUP
if(_canvasgroup.gameObject == null)
{
return true;
}
// Debug.Log("Put on Screen: " + _canvasgroup.name);
_canvasgroup.gameObject.SetActive(true);
float alpha = _canvasgroup.alpha;
float lerpFactor = 0;
while(_canvasgroup.alpha < 1)
{
lerpFactor += _alphaSpeedFactor * Time.unscaledDeltaTime;
_canvasgroup.alpha = $$anonymous$$athf.Lerp(alpha , 1.0f, lerpFactor);
yield return new WaitForEndOfFrame();
if(_canvasgroup.alpha >= 0.99f) _canvasgroup.alpha = 1.0f;
}
yield return StartCoroutine(CoroutineUtil.WaitForRealSeconds(0.1f));
// yield return new WaitForSeconds(0.1F);
_canvasgroup.blocksRaycasts = _interactable;
_canvasgroup.interactable = _interactable;
}
#endregion
}
Do you have any luck to fix this? I'm still use the old Unity version, because this bug still there since 5.2
We are seeing the same issue too, but in our case on a Text object in the UI, so replacing with UIImage is not an option in our case. Only happened when we moved up to Unity 5.2.x
Has anyone tried it with one of the patched versions of Unity? 5.2.1p1 does mention a fix to some UI performance regressions, but not clear if it's the same issue.
I also observe that if you switch the profiler to the timeline view, it is waiting on a canvas sort job during the spike.
Has anyone made a small reproducible version to log an issue with Unity support? Concerned that a fix isn't going to make it into 5.2.2 otherwise ...
Your answer
Follow this Question
Related Questions
How to make a "Click to Continue" text message? 1 Answer
Fade in with CrossFadeAlpha 1 Answer
[4.6 UI] Image fading - How to? 2 Answers
Add smooth parts to UI.Image 1 Answer
UI Image has no sprite definition 0 Answers