Unity3d android 2d sprite placement

Please take a look at this image.
export final game This is the final view of the game exported from Photoshop.
I marked ui sprites with a red marker and game sprites with a blue marker.
My question is how to use these sprites correctly in the development of single3d 2d. Here is how I can think:

  • Use red sprites in the canvas as a component Imagewithin the layout group (vertical or horizontal, so I can put them in a corner and work with each resolution).
  • Use blue sprites outside the canvas and obviously through the component Sprite Renderer
  • Use the blue sprites in the canvas through the component Sprite Rendererand set the canvas rendering mode toScreen Space - Camera
  • Use blue sprites in the canvas through the component Image


, , .
.
- 2017.2.0f, , .

+4
4

Image/Canvas ( ). , CanvasScaler , . ( . HOWTO-UIMultiResolution)

() SpriteRenderer . , . , ( ) , , /.

, , , . , , , Screen.width Screen.height, ( ). , CanvasScaler, , . (. UI Unity Technologies Bitbucket, HandleScaleWithScreenSize 134).

+7

Xarbrough :

  • SpriteRenderer . Image, / .
  • , Button/ScrollView .., Screen Space - Overlay. , , Load Add Add Add . (, , , , .., ).
  • (drag'n'drop, , , EventTrigger), Screen Space - Camera, .
  • , (, - RPG), World Space.
+3

IMO. / , UGUI . , , UGUI ( ).

+1

Canvas , , , RectTrasnform, , , "", .

, /, .

Why do we need to put it with sprites and not put it on the canvas, because RectTransform and Transform behave differently, use Transform if you want to use Physic, when you use Transform instead of RectTransform, you will work in World space, but if you use RectTransform with Canvas, you will work in Screen Spaces, which will make it more difficult and inacuratte.

+1
source

Source: https://habr.com/ru/post/1688820/


All Articles