automatic screen resolution for Android?

Hey all, I’m pretty new to Android applications and coding in general and was wondering if there is a way to make my main camera automatically adjust to different screen resolutions for mobiles that run Android?

I’m not asking for an in depth tutorial but I’ve looked over and have found no real easy answers, I’d just like a bit of help on getting started. So do I need to use code or does Unity have a way of doing this already in the engine?


@ShazBang, I have created following [|63542] that automatically scales game object and reposition its position according to Android / iOS or any device.

Place this script on each game objects that you need to scale or reposition according to device.

||                                     //
|| @author : Darshan Mehta            //
|| @email :   //
||                                  //

using UnityEngine;
using System.Collections;

public class ScaleRepositionScript : MonoBehaviour
	public bool isScalableX;
	public bool isScalableY;
	public bool isRepositionableX;
	public bool isRepositionableY;
	public float ratio = 1.76f;
	void Start ()
		float scaleFactor = Camera.main.aspect / ratio;

		if (isScalableX) {
			this.gameObject.transform.localScale = new Vector3 (this.gameObject.transform.localScale.x * scaleFactor, this.gameObject.transform.localScale.y, this.gameObject.transform.localScale.z);
		if (isScalableY) {
			this.gameObject.transform.localScale = new Vector3 (this.gameObject.transform.localScale.x, this.gameObject.transform.localScale.y * scaleFactor, this.gameObject.transform.localScale.z);

		if (isRepositionableX) {
			if (isRepositionableY)
				this.gameObject.transform.position = new Vector3 (this.gameObject.transform.position.x * scaleFactor, this.gameObject.transform.position.y * scaleFactor, this.gameObject.transform.position.z);
				this.gameObject.transform.position = new Vector3 (this.gameObject.transform.position.x * scaleFactor, this.gameObject.transform.position.y, this.gameObject.transform.position.z);

Hope this works for you.