Best practices for setting up orthographic camera in 2D games

Disclaimer: I’m new to C#, so I apologize if my conventions aren’t up to snuff.

I’m building a minesweeper game as practice while I’m teaching myself how to use Unity. I’ve set it up so that the grid of tiles populates whatever space is available in the window chosen by the user. (The coordinates of each tile increments by 1, with the bottom-left tile at (0, 0)). To get the orthographic camera to display the grid with a thin border in the game, I added this script to the Main Camera object:

using UnityEngine;
using System.Collections;

public class CameraView : MonoBehaviour {

	//import grid dimensions from GetDimensions
	int CamWidth = GetDimensions.useWidth;
	int CamHeight = GetDimensions.useHeight;

	// Use this for initialization
	void Start () {

		// Set the size of orthographic view. ( = 1/2 of grid height)
		Camera.main.orthographicSize = (CamHeight / 2) + 1;

		// Set the camera position to the centre of the grid.
		transform.position = new Vector3 ((CamWidth / 2), (CamHeight / 2), -10);

So far this has worked fine in testing, and although it seems like the most straightforward approach to me, I haven’t seen similar camera manipulation in other questions.

Is there any reason that positioning the camera like this when the scene loads would be bad practice?

What is generally considered to be the best practice for setting up the camera view from a script when the size and position of the play area isn’t known before loading?

Many thanks,


I think the only relevant value is the orthographic size with which you can adjust the height, the only thing that’s possible due to resolution differences.