Version: 2022.2

Camera.allCamerasCount

切换到手册
public static int allCamerasCount ;

描述

当前场景中的摄像机数。

返回 Camera.allCameras 所返回数组的大小以及 Camera.GetAllCameras 将填充的摄像机数量。

using UnityEngine;

public class ExampleScript : MonoBehaviour { private int count;

void Start() { count = Camera.allCamerasCount; print("We've got " + count + " cameras"); } }