- Home /
What is the relation between Canvas, Main Camera, and Sprites.
I understood what I did wrong and found out how to fix it, but I'm very curious about the WHY it was wrong.
Here is the problem:
I have a Canvas (set to Screen Space- Camera) . Inside it, a Text Box and 2 sprites. It is all visible from the Scene window, but in the Game window, only the Text box is visible. When you press Play, the main camera the text from the Text Box, and could not view the sprites. Until I dragged and dropped the Main Camera to the Canvas' Render Camera section.
I hope I gave enough details, and the problem isn't too vague but i'm really curious. Please explain why the sprites were not visible. Thanks!
Answer by UltraGearGames · Jan 23, 2019 at 08:54 PM
Sprites need to be placed to where the camera sees in the Scene, not the canvas like you do with text, Like in 3D, there you also need to have your objects in your camera view to see them, except in your case its 2D. Hope this helps!
EDIT: And really, any GameObject other than canvas objects need to be placed into the camera's view for them to be visible. Also, one tip, when working in 2D, watch out for the Z axis. It still exists, and functions like normal (which is useful for some layering, but watch out, it can be the reason you might not see a sprite on the screen).