- Home /
How can i use sprite inside Canvas ?
I am making a 2D Multiplayer game which position of the charachters are critical.
That's why i have to use canvas. In all resolutions charachters positions should be the same.
However when i use canvas, sprites are not useful because of canvas need images, not sprites.
How can i use sprite characters&weapons inside Canvas ? What professionals are doing about it ?
Answer by ajaykewat · Feb 19, 2020 at 08:53 AM
Hi @sezercanaktemur , you cannot have sprites over canvas, because canvas rendered over the screen if you have chosen screen space overlay. While sprites are rendered based on there word position location and camera needs to track them every time. Whereas if you are using canvas as default then it don't bother about your camera position.
For making 2d multiplayer game you have to play with camera.
You can have a look this tutorial from unity to get actual idea of making 2d game and using canvas.
https://learn.unity.com/tutorial/live-session-making-a-flappy-bird-style-game
Answer by sezercanaktemur · Feb 19, 2020 at 05:22 PM
Thank you @ajaykewat But if i want to make multiplayer 'VS' game how camera should work?
Because if resolution is 1920:1080p it works nice because my scene is based on that. However, if screen resolution is 800*600, then enemy charachter will not be in the scene
1920x1080 800x600
yea, unity is one hell in that case. if you press on a sprite/UI element, you have scale options and there you can make it so it works. that is very frustrating to work with tho
Your answer
Follow this Question
Related Questions
I'm having a problem with UI responsiveness 0 Answers
Virtual joystick and canvas scaler 0 Answers
Resize every GameObject after screen resolution? 1 Answer
Aspect Ration For 2D Sprites and Canvas 0 Answers