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!

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.

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?

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.