public void CopyFrom (Camera other);

参数

other将摄像机设置复制到另一个摄像机。

描述

使该摄像机的设置与另一个摄像机相匹配。

将从另一个摄像机复制所有摄像机变量(视野、清除标记、剔除遮罩等)。 此外,该函数还将该摄像机的变换以及层设置为 与另一个摄像机匹配。

如果您希望在自定义渲染效果(例如在使用 RenderWithShader 时)时 让一个摄像机匹配另一个摄像机的设置,该函数将非常有用。

// Two cameras.  One based on the Main Camera and the other on a new camera that takes over.

using UnityEngine; using System.Collections;

public class ExampleClass : MonoBehaviour { public Camera cam;

void Start() { // Set the current camera's settings from the main Scene camera cam.CopyFrom(Camera.main); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961