I’m having this really weird issue with my build. This is the standalone build. I haven’t tried a WebGL build yet due to this issue.
While testing inside of Unity, the camera shows exactly what is expected, meaning the aspect is restricted to a 9:16 ratio, however, when I build the game and run it, the window is a bit wider than that, and it causes the boundaries to be set beyond the background.
The enemies still spawn in the exact location outside of the background as set down by the enemy spawner and due to the expanded width, they appear on screen before they’re supposed to. The background does not extend beyond where it is set in Unity, but the player can move outside the background and only stops once they are at the edge of the screen and are in the negative space outside the rendered background image.
I’ve followed along with the build instructions, and have tried a few other things I’ve found on google, but can’t seem to figure out this issue.
What resolution did you set in File > Build Settings > Player Settings?
The game window is just a preview. It does not determine how your game will look like or what resolution your build will have. Also bear in mind that the space on your screen is limited.
If you set a resolution in the Player Settings but the build does not use this resolution, the reason might be the PlayerPrefs. In newer versions of Unity, there is an option in the top horizontal menu to clear the PlayerPrefs. If there is none in yours, write a script. You can find an example in the API.