Foreground and Background

Hey guys, I’m doing kind of a 2d game. I want to know how I can place gameObjects in front of, or behind other gameObjects? Think “bring to front” or “send to back”.

Thank you.

Even though you may be building a 2D game, Unity is still a 3D game engine. Every game object has a position that is defined as an X, Y and Z coordinate. X and Y are the “plane” of your monitor while you can think of “Z” as the depth “into” your monitor. If you have two game objects that overlap each other, the one with the closest (smallest) Z coordinate will be in front of the other. Because you are building a 2D game, you should also be looking to use an “orthographic” as opposed to “perspective” view so that objects that are further away don’t appear any smaller than objects that are closer.