Language: English
  • C#
  • JS
  • Boo

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Camera.orthographic

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
var orthographic: bool;
bool orthographic;
orthographic as bool

Description

Is the camera orthographic (true) or perspective (false)?

When ortho is true, camera's viewing volume is defined by orthographicSize.
When orthographic is false, camera's viewing volume is defined by fieldOfView.

See Also: camera component, transparencySortMode.

	// Set the camera to be orthograpghic

camera.orthographic = true;
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Example() {
        camera.orthographic = true;
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Example() as void:
		camera.orthographic = true

Specifically for the main camera:

	// Set the main camera to be orthographic

Camera.main.orthographic = true;
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Example() {
        Camera.main.orthographic = true;
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Example() as void:
		Camera.main.orthographic = true