Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

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

static var allCameras: Camera[];
static Camera[] allCameras;
static allCameras as Camera[]

Description

Returns all enabled cameras in the scene.

	var count : int = Camera.allCameras.Length;
	print ("We've got " + count + " cameras");
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public int count = Camera.allCameras.Length;
    void Example() {
        print("We've got " + count + " cameras");
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	public count as int = Camera.allCameras.Length

	def Example() as void:
		print((('We\'ve got ' + count) + ' cameras'))