- Home /
Unity 2D Position Issues
Hello! so, i'm trying to make my 2D game, as i'm sure many other people are at this time. But i'm having issues finding the current position. note that everything is already optimized for 2D. I'm trying to place pixel perfect measurements so the player can walk right up to the very edge of the background, but never see any blue. when all positions of camera, player, and bkg are 0, they all display perfectly in the middle of the screen regardless of resolution (all sprites are rendered from the left at 100 pixels per unit). So, if it's 100 pixels per unit, and 0 is at half of the screen resolution, i thought the position offset would be (resolution / 2) / 100. problem is, this doesn't seem to work. at all. and I can't get the camera size to make it work either (i made it at 2.5 so it's the exact size of the images). and the numbers to get the position exactly right are absolutely bonkers random too. if my camera size is 5, and my res width is 1280, my camera (or background) must be positioned at exactly 10.16 x to perfectly hide the blue. before unity 2d, i was trying to work with GUI texture, and i never had this kind of problem (then again, it used offset and not unit position). Can someone help me out here? I just want to figure out the very "edge" of the background so to speak in terms of position so that i can program it so the player/camera will never go past the background and show any blue.
Your answer
Follow this Question
Related Questions
C# - Offset In-Air Camera from Current Object Position 1 Answer
Camera changes position? 1 Answer
Is it possible to keep the player offset in place on the screen independent of resolution? 1 Answer
swap between 3 gameobjects mid game 0 Answers
Help! I want to make a following camera but in with Y position is constant ? 2 Answers