Answer the question
In order to leave comments, you need to log in
What is better to use? Image or just sprites?
What is better to use in the game 2d menu and in the 2d game itself? The problem is that it’s easy to do in the menu through Image but not in the game itself, because if I put imeg it overlaps the usual sprites (of the player), I tried to make it also a yuay element (I realized that this is nonsense). If you can simultaneously use the Image UI background and just the player’s sprite, then how? this only works with other ui elements
Answer the question
In order to leave comments, you need to log in
Back can be done using Canvas'a in world coordinates. The problem of overlap is solved by setting the layers and Order'a inside them: SpriteRenderer -AdditionalSettings fields SortingLayer & OrderInLayer; Canvas - SortingLayer & OrderInLayer(RendererMode == WorldSpace). But why use it?
For a better understanding of what and when to use, it is worth understanding how the UI is rendered in general and how you can easily lose performance by inserting canvases everywhere (every change to the canvas element marks the nearest canvas "dirty" and starts recalculating for drawing on the next frame, which is for performance really not very much).
If there is a need for back to look the same on different devices, then this logic should be implemented through code (basically, all calculations will be tied to AspectRatio - aspect ratio)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question