Version: 2017.3
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); } }