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
1
Question by mediamavrick · Mar 09, 2014 at 05:50 AM · mobileplatform

How do I make sure my game fits on all mobile platform screens?

Im building a game and in the game tab of unity I made sure its 320x480 as I was told is standard for mobile devices. My problem is that I am not sure if it will fit on all screen seeing as a tablet for example, is not the same size as a smart phone. Does anybody have any suggestions as to how to make sure it fits on all mobile platforms?

Comment
Add comment · Show 8
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 Eric5h5 · Mar 09, 2014 at 06:51 AM 2
Share

Indeed, exactly what you do depends on the game. With something like Bejeweled, for example, you might decide to make the "important" part an average aspect ratio like 2:3, and use fluff around the gameplay area to pad out the borders on either the sides or top/bottom, depending on taller or squatter screens. Then you have something like Jetpack Joyride, where you'd anchor the character to the right edge of the screen, which scrolls from right to left. You can't anchor to the left edge, because then people with wider screens would have an unfair advantage of having slightly more time to react to obstacles.

avatar image fifthknotch · Mar 09, 2014 at 07:00 AM 0
Share

Exactly! It depends 100% on your game. I personally have only released my game on iOS. Because Apple only has two screen sizes, I didn't have to worry about GUI or aspect ratios. I just measure the exact resolution and set my HU elements to fit that resolution (real simple since there are only two resolutions, but now I here talk of bigger screens... haha ).

avatar image Eric5h5 · Mar 09, 2014 at 07:12 AM 0
Share

Well...there currently is 640x960 3.5" (the 4S is still relatively common), 640x1136 4", 768x1024 10" (iPad 2 also still relatively common), 1536x2048 10", 768x1024 8" (iPad $$anonymous$$i), 1536x2048 8", so...a bit more than 2 screen sizes. ;)

avatar image fifthknotch · Mar 09, 2014 at 07:19 AM 0
Share

Haha yes I meant to say for iOS iPhone/iPods. The iPads, to my knowledge, have a separate App Store. They can still download from the iPhone App Store, but they have to upscale the game. To fix this Apple made a separate App Store for game built for the iPad. That is why iPhone/iPad apps typically have bester performance than the same apps built for android. Its because developers can build their apps specifically for a handful of available iOS devices, compared to the thousands of android devices. Anyone who has used an Android device has seen the "only supports these devices: " on the Goggle Play Store. There is just no way to account for all screen sizes, all different specs, and all different makers.

avatar image Eric5h5 · Mar 09, 2014 at 07:37 AM 0
Share

No, the store is mostly the same for all iOS devices. There was more separation originally, but now you typically build apps that run on both.

Show more comments

3 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by Eric5h5 · Mar 09, 2014 at 06:27 AM

320x480 is totally not standard for anything except old iPhones that aren't used much anymore. Don't hard-code for any particular resolution; anchor GUI elements to screen corners instead, and make sure the camera can handle multiple aspect ratios (4:3 though 16:9 at least, or 3:4 though 9:16 depending on screen orientation). Change the game view size and aspect ratio frequently while developing to make sure it continues to work on all screen sizes. Also make your GUI resolution-independent, so high-dpi screens don't get stuck with tiny GUI elements.

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 IvayloDev · May 19, 2016 at 08:20 AM 0
Share

How can you anchor object which dont have rect transform? Im trying to animate UI elements, but the animations are lagging and it not smooth. The objects are not even UI, but thats just the only way I know how to make them fit on every screen, if they are on the hierarcy the animations are smooth but they cannot be positioned correctly

avatar image
2

Answer by fifthknotch · Mar 09, 2014 at 06:39 AM

This is probably one of the most popular questions mobile developers ask yet impossible to answer because there exists no one, simple answer. There is no simple way to make your game fit on ALL screens. Period. Different methods of trying to include:

-making your camera view only set resolutions (very bad option because you lose all the excess screen) -using GUI to dynamically set your input/HUD elements during gameplay (this can be a bad option because Unity's GUI is very processor heavy and is not ideal for mobile devices) -manually checking for common aspect ratios and position/scale your input/HUD elements depending on those common aspect ratios

Also as far as 320x480 is concerned, that is a resolution. You are more interested in aspect ratios because resolution is continually increasing, but aspect ratios are staying relatively the same. For example. 320x480 is the aspect ratio 2/3. This happens to also be the aspect ratio of the iPhone 4s and before, even though the iPhone 4s's resolution is 640/960. 1080x1920 is 9/16, iPad's aspect ratio is 3/4. Screen aspect ratios vary, but screen resolutions vary so much more).

If you find an alternative GUI to use, such as NGUI, that is probably the best option. Otherwise using aspect ratios may take longer to setup, but also is a viable solution.

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
1

Answer by Alliballibaba · Feb 19, 2020 at 12:12 AM

SInce this is still relevant, I wrote a small script that blacks out anything outside of your preferred aspect ratio. Just put it on your camera. Might not be exactly what you're looking for, but it's a quick fix.

using UnityEngine;

 public class FixCamera : MonoBehaviour
 {
     // change these numbers to your preferred apect ratio (9:16 in this case)
     const int resolutionX = 9;
     const int resolutionY = 16;
 
     void Start()
     {
         float screenRatio = Screen.width*1f / Screen.height;
         float bestRatio = resolutionX*1f / resolutionY;
         if (screenRatio <= bestRatio)
         {
             GetComponent<Camera>().rect = new Rect(0,(1f- screenRatio / bestRatio)/2f, 1, screenRatio / bestRatio);
         }else if(screenRatio > bestRatio)
         {
             GetComponent<Camera>().rect = new Rect((1f- bestRatio / screenRatio) /2f, 0, bestRatio / screenRatio, 1);
         }
     }
 }
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

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

26 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

Related Questions

Is there a list of the Top 10 Unity Community? 0 Answers

How to only get touch on specific object? 0 Answers

iOS and Android Publishing 2 Answers

How do I have my first person travel along with a moving object? 1 Answer

What is this error and how can i fix it? 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