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 Pigghaj · Jan 26, 2012 at 09:11 PM · android3dresolution

Android different resolutions in 3D (not GUI)

Hi,

I've been looking all over the internet for some type of guide on how to make your Unity game work best on all the different Android resolutions.

I have come across alot of questions and answeres regarding how to make GUI work, but nothing on how to actually set up your 3d space to work well. Everyone just seem to assume it works... but does it? How?

Can anyone explain exactly how it works? If I have a game that is purely 3D (no GUI), is there a way to make it work on all Android resolutions available without having to make different versions of the game for each different resolution / aspect ratio?

I am developing a puzzle game in 3D so I need to keep my objects on specific locations in 3D world, and make them appear exactly, or at least almost exactly, at the same place on the screen in different resolutions.

Any suggestions which is the easiest way to accomplish this? Or if you have seen this asked somewhere else, or know some type of guide, etc. I just cant find any real good info anywhere.

Thanks!

Comment
Add comment · Show 4
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 Hanseshadow.du · Jan 26, 2012 at 11:43 PM 1
Share

Is your game using an orthographic camera?

camera.main.orthograhicSize

Orthographic $$anonymous$$ath: http://forum.unity3d.com/threads/113641-Orthographic-screen-size

Orthographic $$anonymous$$ath Answer: http://answers.unity3d.com/questions/174002/what-is-the-relationship-between-camera-size-units.html

avatar image Eric5h5 · Jan 27, 2012 at 01:02 AM 0
Share

@pigghaj: don't post comments as answers please.

avatar image Pigghaj · Jan 27, 2012 at 01:08 AM 0
Share

Sorry, I didnt figure out what was what at first.

avatar image Hanseshadow.du · Jan 27, 2012 at 01:41 AM 0
Share

If you are using an orthographic camera, here's a previous answer for you.

http://answers.unity3d.com/questions/174002/what-is-the-relationship-between-camera-size-units.html

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Eric5h5 · Jan 27, 2012 at 01:00 AM

3D is inherently resolution-independent. If the camera is at position 0,0,-10 pointing forward and an object is at position 5,0,0, then the object will always appear in the same relative position no matter what the resolution is. The only thing you have to be concerned with is aspect ratio; the general approach is just to make sure everything critical can be seen in 4:3.

Comment
Add comment · Show 8 · 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 Pigghaj · Jan 27, 2012 at 01:14 AM 0
Share

Eric: Yeah thats basically what I was thinking too... that its the aspect ratio that is the main problem.

On a mobile phone screen in puzzle game I really cant afford to "waste" everything outside the 4:3 aspect. Especially not since most screens have an aspect ratio more similar to 3:2 or 16:9 and a couple of odds ones in between.

Thats why I wonder how to approach that problem. If its somehow possible to calculate or scale the position and size of object to make it work on different aspect ratios (using all available screen size), or if I manually need to create different versions of the game for all the different aspect ratios...?

avatar image Hanseshadow.du · Jan 27, 2012 at 01:50 AM 0
Share

I make a game board that I test in each aspect ratio. That's how I made my last five board games. I put 3D text meshes for scores and information. For elements in the game, I use ray casting and check mouse buttons for clicks. It avoids all the disconnect between the GUI and game objects.

However, if I were really concerned about it, I would make the game board and size the camera based on the screen size. I just happen to have made all my game boards functional in 4:3, like Eric mentioned.

avatar image Eric5h5 · Jan 27, 2012 at 02:01 AM 0
Share

@pigghaj: you'd use whatever the narrowest aspect ratio is. If nothing your game runs on is narrower than 3:2, then make 3:2 the standard.

avatar image Pigghaj · Jan 27, 2012 at 02:07 AM 0
Share

Hanse: This is for Android phones though, so I cant just do it 4:3 since there are so many phones with very different resolutions and aspects ratios. I could resize the camera depending on aspect ratio but it still would mean I am probably gonna have issues with unused space in some aspect ratios i think?

Eric: I am thinking there has to be a better way. Have you ever seen an Android game that doesnt fill out the whole screen?:) But perhaps the only way is manually arranging things for different aspect ratios...

avatar image Hanseshadow.du · Jan 27, 2012 at 02:31 AM 0
Share

Eric is correct about the narrowest aspect ratio usage. All the boards I've used have been exactly square, so I haven't had to make a rectangular area fit in Unity. All my apps work on Android devices and I haven't had aspect issues with them (phones and tablets). However, I did lock them to landscape mode.

Show more comments
avatar image
0

Answer by Pigghaj · Jan 27, 2012 at 03:26 AM

Hanseshadow:

I have also decided not to use GUI and instead keep everything as 3D object. But I am not sure how to present text and numbers. In my 2D version I use sprites that contains the text I need to show. You said you used 3d meshes for text? And this works fine? I am thinking it could have a big impact on performance if you have alot of text and stuff in 3d?

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 Hanseshadow.du · Jan 27, 2012 at 05:13 AM 1
Share

3D Text $$anonymous$$eshes are not a huge impact. Each character is two polygons. If you had 1000 words of 8 average characters, that's only 16000 polygons. I highly doubt you would ever have that many words on a page, much less in a scene.

Besides, as a senior technical designer who has done many AAA games in the past 20 years, people do not like to read. They're lazy. :)

avatar image
0

Answer by BroVodo · Sep 11, 2012 at 02:42 PM

 var edge : int = -1;//which screen edge 0 - 4, top, right, bottom, left
 var edgeCam : Camera;
 function Start()
 {
     ToEdge( edge );
 }
 
 function ToEdge( e : int )
 {
     if( e == -1 )
     {
         return;
     }
     var b : Bounds = renderer.bounds;
     var t : float = 0.0;
     var se : Vector3 = Vector3( 0, 0, 0 );//screen edge
     var translateAmount : Vector3 = Vector3( 0, 0, 0 );
     
     if( e == 0 )//top
     {
         se = edgeCam.ViewportToWorldPoint( Vector3( 0, 1, 0 ) );
         t = se.y - b.center.y - b.extents.y;
         translateAmount = Vector3( 0, t, 0 );
     }
     if( e == 1 )//right
     {
         se = edgeCam.ViewportToWorldPoint( Vector3( 1, 0, 0 ) );
         t = se.x - b.center.x - b.extents.x;
         translateAmount = Vector3( t, 0, 0 );
     }
     if( e == 2 )//bottom
     {
         se = edgeCam.ViewportToWorldPoint( Vector3( 0, 0, 0 ) );
         t = se.y - b.center.y + b.extents.y;
         translateAmount = Vector3( 0, t, 0 );
     }
     if( e == 3 )//left
     {
         se = edgeCam.ViewportToWorldPoint( Vector3( 0, 0, 0 ) );
         t = se.x - b.center.x + b.extents.x;
         translateAmount = Vector3( t, 0, 0 );
     }
     transform.Translate( translateAmount );
 }

This script will move 3d elements to the edge of an isometric camera. It's helpful for making maximum use of screen space at different resolutions.

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Android Screen Resolution (Joysticks) help. 2 Answers

Making Unity player background as transparent in android app 0 Answers

Android live wallpaper 1 Answer

A node in a childnode? 1 Answer

3rd Person Control for Android? 0 Answers


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