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 JordanH · Mar 11, 2014 at 02:25 AM · cameraresolutionscreen size

Scale camera to fit screen size

I am programming a game in unity using 2D and C#

The problem is how do I make it so that my game will be supported on all iOS devices? The camera cuts off some of the scene depending on the iOS device, how do I code it so it does not cut anything off. I also can't seem to clamp my player to the screen, the player keeps running out of the screen. How do I do this since the player position is not given in screen coordinates.

Comment
Add comment · Show 1
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 robertbu · Mar 11, 2014 at 03:02 AM 0
Share

It is unclear what the right solution is for your game. If you don't care if your objects get stretched or squished, you can change the projection matrix for the camera:

http://answers.unity3d.com/questions/635701/screen-resolution-scaling-no-solution.html

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Kilroymyboy · Mar 11, 2014 at 03:28 AM

Im just learning myself, but so far i made a simple pong that works on any resolution.

pretty much i used Screen.height and Screen.width to grab the screen's resolution in pixles but keep in mind unity is measured in units.

to convert them i used this method based of the Camera class

 screenToWorldPoint (new Vector3 (0f, Screen.height*2f, 0f)).y);

im really sorry i couldn't help more. I have no clue how screenToWorldPoint works. i just followed the unity documents.

Comment
Add comment · Show 4 · 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 JordanH · Mar 11, 2014 at 03:45 AM 0
Share

Ok awesome! Which unity documents did you follow? Do they have a pong guide that you used?

avatar image Kilroymyboy · Mar 11, 2014 at 04:39 AM 0
Share

yeah ill send u a link of a guide i followed,

https://www.youtube.com/watch?v=rlL$$anonymous$$wNI53Oo

if u go to time 17:25 u will see the example im talking about.

sorry for late reply. new to this website

avatar image JordanH · Mar 11, 2014 at 04:47 AM 0
Share

Its ok I am also new. Thanks for the link! I tried giving your answer a thumb up but it won't let me.

avatar image Kilroymyboy · Mar 11, 2014 at 04:57 AM 0
Share

thanks anyways. hope it helps. Just a note he does program in Javascript. I use C#

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

21 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

Related Questions

camera and screen is much farther out on android build? 0 Answers

Why Is My Orthographic Camera Not Rendering at the Full Resolution? 1 Answer

resolution is squished horizontal on android 0 Answers

How to set constant orthographic viewport? 1 Answer

how to shrink the cameras resolution in unity 3d 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