The difference between texture and sprite usage

1. When to use Texture?

  1. When the picture is too large to be suitable for synthesizing the atlas, you can use Texture. At this time, try to ensure that the width and height of the picture are 2 to the Nth power;
  2. There are few places to use. When the picture is 2 to the Nth power and the frequency of occurrence is not high, Texture can be used. Such as the background and logo of the game;
  3. For pictures that need to be changed frequently, in order to reduce the trouble of updating and maintaining each time, you can use UITexture;
  4. Summary: The function of Texture is to display a picture on the screen. In this regard, it has a similar function to Sprite, but Texture will consume a separate DrawCall to render, and will be loaded into memory separately, so it will increase program performance. overhead.

2. When to use sprite?

  1. The picture is small and will be used in many places (such as buttons, icons). Try to put the picture into the atlas and use it in the way of sprites;
  2. If the shape is irregular, and the length and width are not 2 to the Nth power, then Sprite must be used. Because unity is much slower to process images that are not to the Nth power of 2;

Reference articles: The difference between uitexture and sprite , Unity UGUI series two material SpriteRenderer and Image

おすすめ

転載: blog.csdn.net/weixin_42205218/article/details/126506660