Version: 2017.3
public void CopyFrom (Camera other);

Parámetros

other Copy camera settings to the other camera.

Descripción

Makes this camera's settings match other camera.

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.

This can be useful if you want one camera to match the other camera's setup, when doing custom rendering effects. For example when using 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