Hi there! Unity 2017.4.27f .Is this a regular behaviour ? This is static scene with 24 batches and 17 setpass calls.
Here is my profiler in Editor with same metrics
My UI profiler
Iāve tried to optimize UI and replace Mask to RectMask2d, and it becomes 2.5x slower. Why me scene so slow on android device? Any suggestions?
Hello @LeonhardP , can you please confirm if the fix mentioned in
is included in 2017.4.24f1 or 2017.4.27f1?
Like justtime, Iām having a very significant hit in UpdateBatches:
Itās important since Iām aiming 60fps.
Also, do you have any tips to profile UI? I donāt know if this is normal or too high, but I have a really simple UI at this stage, it should perform well.
Iām using 2017.4.24f1 and profiling from a iPad mini 4.
I had (have) this exact problem and I am not sure if this is the same thing but just throwing it out there just in case some have the same setup as me. In my case it turned out that I was using an animator to change colors of a text (TMPRO). I guess every time something is changed in the UI it has to redraw that whole element. This one little animated text cost over 20ms. I havenāt found a āgoodā solution for this yet -just gave up for now and removed the animation.
I guess I can create a mesh of this with text typed into the texture and remove it from UI and place it as a decal.
@roberto_sc what profiling tool are you using in your screenshot, I havenāt see that before?
That is correct. See āUI Canvas rebuildsā in the following document for an explanation:
https://learn.unity.com/tutorial/optimizing-unity-ui#5c7f8528edbc2a002053b5a2
You can also see in the UI code, whenever Unity notifies the UI that any animation property changed, the UI dirties and rebuilds everything:
https://bitbucket.org/Unity-Technologies/ui/src/31cbc456efd5ed74cba398ec1a101a31f66716db/UnityEngine.UI/UI/Core/Graphic.cs#lines-749
Unity Technologies solution to this, as discussed in some Unite talks and probably learning material as well, is to split the UI across multiple Canvases. If you have UI elements that change frequently, move them to a separate Canvas, so Unity does not have to rebuild UI elements that are not on that Canvas.
Thanks. Yeah, I have already seen those talks (it is in Unity optimization talks by Ian), and I already tried placing the text in question under a separate Canvas it was only slightly better, no significant improvement. Maybe this also has something to do with text being updated every frame. I am not sure how exactly this is done in TMPro underneath. It is a world space canvas some not sure if these work differently as far as updating goes. Best I have come up with is not to use the UI. Just create a mesh and type out the text to that and just animate the material color.
P.s. I did have this canvas as a child canvas of the root. Does it have to be a completely separate canvas?
āSeparate canvasā in the sense that it needs to have a different Canvas Component. According to my test, it does not make a difference whether Canvases are siblings or nested.
For example, in this test:
The āScroll Viewā contains a gazollion UI elements and itās very slow to update. However, if I enter text in the āInputFieldā, which is part of āSub Canvasā, Unity only rebuilds the āSub Canvasā part, but not the elements under āScroll Viewā.
I tested it with Unity 2019.1.2f1, test scene attached.
4868579ā469247āscene.zip (285 KB)
Yeah thatās what I gathered also. In my case itās literally a canvas, background image and a Text element (TextMeshPro) -see attached. All I am doing is updating the text color and this massive spike. I am also in VR so that probably doesnāt help things. I will revisit this later try to figure this out. I will share what I find.
Maybe this is part of the problem that talks about on this thread. Well at least in my case this is a non-essential item so I am going to push this aside for now and move on to the next.
Thanks for these links, I will take a look.
In my case performance was bad because the main canvas had its render mode set to a camera that was moving all the time.
@FlightOfOne thatās the profile analyzer, itās awesome: Unity Blog
Awesome! Thank you.
Hi ! Whatās your proifle tool used? Itās interestingļ¼