Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 Rokas666666 · Sep 07, 2020 at 08:15 AM · camerafullscreenaspect-ratio

Centering aspect ratios in fullscreen

alt text

Hello

The game I am making uses a 1:1 aspect ratio. This works fine, however, when I go into fullscreen, the entire screen is pushed all the way to the left as you can see in the picture. This is just annoying to look at and I'd much rather have it in the center.

However, I would like to retain the aspect ratio as there are some parts of the game that also need to work with the square screen. Is there a way to just center the screen, so that the picture would look the same, except the game is in the center of the screen? If not or if it is really hard and innefficient, I'll probably just make the screen fit whatever aspect ratio people play with and then add black bars on the GUI.

1by1center.png (106.7 kB)
Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Bunny83 · Sep 07, 2020 at 08:25 AM

Well, it's completely unclear what we're actually looking at and how the graphics are produced at the moment. Is this just UI? Do you actually use a camera to render this? How did you actually ensure this aspect ratio? When you use a camera, you can simply restrict the rendering area to whatever screen region you want. There you can also fix varying aspect ratios. Of course the remaining area would not be rendered at all and could cause visual artifacts, depending on the target platform. So when using a camera to render your game, it's generally better to have two cameras. One that renders / clears the background and one that is restricted to the screen center and actually renders your game content.


If this is actually just UI stuff it gets even more diffuse since there are countless of different ways how things can get arranged on the screen. So without further details on what we're currently looking at this can not really be answered.

Comment
Add comment · Show 1 · Share
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 Rokas666666 · Sep 07, 2020 at 02:35 PM 0
Share

Fair enough. I am new to both Unity and asking for help in Unity, so thanks for asking specific questions that could help you help me.

This is rendered by the $$anonymous$$ain Camera object and this is the main view of the game, text at the top left being in the only UI element, which is rendered with a canvas. I have created this aspect ratio, by changing the width and height to 1.5f in the script and then by setting the Camera.aspect to 1/1.

For UI, I used GUI for a special effect in specific parts of the game (that is what all of my references to UI are for in the original comment)

This phrase: "When you use a camera, you can simply restrict the rendering area to whatever screen region you want" is what I believe I've done - there are many more gameobjects outside this view but I restricted the camera to only see a 5*5 grid. $$anonymous$$y confusion comes from not being able to move this camera to the center, so that there would be black background both left and right of the main camera, not just to the right.

After some experimentation, I was able to create this alt text

which achieves the desired effect (in game, the camera now goes across the entire screen, but the black bars are above other elements and so the 5*5 grid is the only thing shown), but this will force me to do some more effort in adjusting some effects that relied on the square being a camera (such as zoo$$anonymous$$g out and a texture that goes across the entire screen). Though this isn't a large problem, I am simply curious about a method that would keep a 1:1 aspect ratio and would simply allow me to move the camera to the center of the screen.

editor1by1center.png (20.8 kB)

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

208 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 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 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 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 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 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 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 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 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 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 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 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 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

How do i place borders and sprites on camera edges? 0 Answers

Keep Aspect Ratio like in Unity Editor 2 Answers

How to force the game to be stretched to fit the screen? 1 Answer

Switching camera - C Sharp 3 Answers

Scale Everything In Game to Fit all screen Sizes 1 Answer


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