Camera.main == null 为什么?

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ZFSR05255134/article/details/81191838

Camera.main 主相机

static var main : Camera

Description描述

The first enabled camera tagged "MainCamera" (Read Only).

第一个启用的被标记为“MainCanmera”的相机(只读)。

Returns null if there is no such camera in the scene.

如果场景中没有相机返回Null.

https://docs.unity3d.com/ScriptReference/Camera-main.html

也就是说,如果场景中没有任何摄像机Tag被标记为 "MainCamera",则返回null

猜你喜欢

转载自blog.csdn.net/ZFSR05255134/article/details/81191838
今日推荐