public void CopyFrom (Camera other);

Description

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

This will copy all camera's variables (field of view, clear flags, culling mask, ...) from the other/ camera. It will also set this camera's transform to match the other camera, as well as this camera's layer to match the layer of the other camera.

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


using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { Camera cam;

void Start() { // Set the current camera's settings from the main scene camera cam.CopyFrom(Camera.main); } }