Today I focus on some optimizations related to the UI
Let’s talk about the canvas, only the main element of the interfaces, it often happens to see only one canvas inside all the types of elements that represent the game UI.
This does not help from the point of view of resources because every time a change occurs in the UI the whole canvas is reinitialized to update.
A solution to consider could be to split the UI and create a more dedicated canvas.
A second trick concerns the components within the canvas, many UI objects have the ability to be selected, not just buttons, and for this, they have a component that allows them to receive a raycast. The solution to avoid overlapping is to check the single components and deactivate the “Raycast Target” flag.