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 e-bonneville · Jun 29, 2012 at 02:21 AM · orthographic camera

How do I get a 1:1 pixel ratio?

I'm interested in making a tile-based game in Unity. One of my main concerns with this tile game is that the game should have a 1:1 pixel ratio with the tiles, so that the tiles will always display at exactly the same size on the screen, no matter the resolution of the standalone. How do I do this? I tried this script:

 @script ExecuteInEditMode()

 var spriteSize = 64.0;

 // set the camera to the correct orthographic size (so scene pixels are 1:1)
 s_baseOrthographicSize = Screen.height / spriteSize / 2.0;
 Camera.main.orthographicSize = s_baseOrthographicSize;

But it doesn't do the trick--as I change the size of the editor window, the size of my tiles onscreen changes. So, how do I get a constant 1:1 pixel ratio in my game, such that a pixel in one of my assets from Photoshop is equivalent to a pixel on the screen of my game, and will be so regardless of the game's resolution?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
-1

Answer by Al-Anselmo · Jun 29, 2012 at 03:49 AM

You need "Pixel Perfect". There are several Unity plugins that can easily provide Pixel Perfect to your project. For example, here are some that I can remember:

  • Sprite Manager (is free and you can get it in UnifyCommunity)

  • Sprite Manager 2 (is a paid and more robust version of the free one)

  • Ex2D

Also, there's a thread that may help you to set manually this 1:1 pixel ratio: Displaying exact pixels with SpriteManager.

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
avatar image
0

Answer by SmooveB · Jun 29, 2012 at 03:58 AM

Change the filter mode on your texture to point.

But having one of those sprite handlers is really nice. I have been having great luck with 2D toolkit. It is easy to use and the creator of the thing will basically personally answer all your questions on their forum.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Sprite Manager sprite is visible in Scene view but not Game view 0 Answers

Problem firing projectile at mouse location 1 Answer

How would I setup my camera to get a result that looks like Enter the Gungeon? 1 Answer

How does resolution work in 2D and orthographic camera 1 Answer

3DText is rendered in front of rendertexture. (SOLVED) 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