Version: 2017.1
public void CopyFrom (Camera other);

描述

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

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); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961