Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Swiftpaw · Jul 21, 2013 at 03:31 PM · camera2daspect ratio

Do I need to enforce an aspect ratio for my 2D game

I'm working on a 2D game. I'm using an orthographic camera and the level is procedurally generated as a series of chunks (each chunk is basically a seperate room on a grid). I want the camera to snap to these chunks/rooms as the player moves between them (think Legend of Zelda: a Link to the Past). The camera movement logic is easy enough to implement. The problem comes when you have to take into account different devices/monitors.

Because I want the camera to always show the whole chunk/room and nothing beyond it, I'm thinking that I need to pick an aspect ratio, and enforce it using letter/pillarboxing. Is there a better way of doing this than potentially wasting screen space? Keep in mind, the camera has to show the exact width of the chunk. Setting the ortho height is fine for maintaning the sprites, but it doesn't help with potentially showing things that shouldn't be seen on wider monitors.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image manu3d · Jul 21, 2013 at 09:17 PM 0
Share

Let us get this straight: on wider monitors (or to better put it, monitors with a higher resolution) you want to keep the same sprite resolution (as opposed to creating larger, more detailed sprites). So, if your background sprite for a room is 300px wide, on a screen that is 300px wide it will cover the whole screen width, on a screen 900 pixel wide it will take less than a third of the width of the screen. And you are then asking what to do with the rest of the screen given that you don't want to show the nearby rooms?

avatar image Swiftpaw · Jul 21, 2013 at 09:33 PM 0
Share

$$anonymous$$aybe some more detail will help! The rooms of my game are made up of prebuilt layouts of individual tiles. The full level is made by stitching together these layouts to make random dungeons of connected rooms.

You're right that I don't want the camera to show the nearby rooms, only the room the player is currently in (I want to do it this way for several reasons, but most importantly things not in the current room are deactivated/recycled until needed for performance. You could get some ugly looking problems with tiles and objects disappearing etc. if you could see beyond the walls of the current room.

I'm currently working on the premise that one unit in world space = one tile. I'm not sure yet what the final resolution of the tiles will be I'll admit I haven't really thought about it much yet, currently I'm just using placeholder cubes for it all.

Thanks for the response!

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Managing aspect ratios on multiple resolutions in 2D game 1 Answer

Resizing orthographic camera to fit 2d sprite on screen 1 Answer

Camera.ScreenToWorldPoint with Perspective camera 1 Answer

How can I fix this screen wrapping? 1 Answer

Dynamic shadows in orthographic camera. 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges