Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by ascaron50 · Mar 20, 2018 at 02:59 PM · scalescene view

How to make number of blocks fit the screen space horizontaly and vertically ?

I am trying to fit border blocks around the camera space. If I am running on 1920x1080 resolution and the block sprite is 120x120 pixels(because it divides with 1920 and 1080 with no floating point leftover) and I set the pixels per unit to be 120 in the sprite inspector and start to align them together on the horizontal part I do actually get a leftover, how is that possible ? how can i make the blocks align perfectly on the camera space ? If I calculate 1080 / 120 I get 9 but the blocks seem to be 10. The number for 1920 / 120 is 16 but Ialt text get 18 blocks aligned instead. Am I missing something here ?

problem.png (119.0 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
0

Answer by Darkonekt · Jan 21, 2020 at 04:49 PM

I know this is an old question. But for those that get here through google.....

The problem stems from the default value of the Orthographic camera which is 5.


This means that the vertical size is actuallt 10 Unity Units height.

And 17.777777 Unity Units width.

So when you set the pixels per unit to 120 this makes it so that 10 images fit accross and 17.777777 fit vertically.

The issue here can be solved in several ways.


Solution1:

Set the camera size to 4.5. Doing this will make it so that there are 9 Unity Units in height and 16 accross the width. So by doing this when you set 120 Pixels Per Unit you will effectively get exactly 9 images in height and 16 in width to fit your screen.

Solution2:

Set the camera size to 5.4 and leave the default of 100 pixels per unit on the images. This will have the same effect of being able to fit get exactly 9 images in height and 16 in width to fit your screen.

A couple or formulas to help you:

Correct Ortographics Camera size for a particular pixel per unit setting:

Ortographic Size = Desired Height / (2 X pixels per unit)


Number of width units based on the aspect ratio and camera size:

Width in Units =( (Ortographic Size X 2) / Aspect Ratio Height) X Aspect Ratio Width

Comment
Add comment · 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

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

129 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

Related Questions

Sprites and Shaders : problem with lighting 2 Answers

Mirroring a gameObject 0 Answers

Manipulating Objects in callback 0 Answers

How to dynamically scale an object to a fixed, predefined size at runtime? 0 Answers

Does it Help If you make your Objects Really Small? 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