I noticed in a lot of the live training videos the panels are used as containers and the alpha value is set to 0 to hide the image on the ‘Image’ component.
I know in the past I have had issues with this, especially on mobile platforms with large transparent quads covering the screen and creating pixel fill rate problems.
I was wondering if the UI doesn’t bother sending anything to the GPU if the alpha is set to 0? Alternatively is it OK to remove the ‘Image’ component from the panel?
Well, tbh, as the focus was on UnityActions and UnitEvents, I was not focusing on the underlying UI issues when making the layout for the modal window, which could have been a little misleading.
I don’t have a direct answer if leaving that image enabled, but with an alpha of zero, is an inefficient solution or not.
I can report that in this case of using a parent panel as a holder for a layout group, which is what we were using it for, and that panel does not need to have an image associated with it. The UI tools only care about he Rect Transform for layout purposes - so:
When using a Panel for a layout group holder, you can either use an empty game object (which will only have a Rect Transform, as it’s e child of a canvas) or you can safely remove the image and canvas renderer from the UI Panel element, if you already have a panel.
Basic research (eg: asking the UI team) says there is optimisation going on, but I didn’t get an answer to what extent.
I will annotate the live training session when I process it to reflect this information so everyone is clear.
Please note, there are a few cases where the parent needs to have its image element available with an alpha of zero if there is no image needed, but these cases are noted in the training modules and sessions.
(Sadly, I can’t remember off the top of my head when this use case arises… But I’ll add to this post when I dig that up…)