Version: 2017.2

ExposedReference<T0>

struct in UnityEngine

切换到手册

描述

创建一个值在运行时可加以解析的类型。

ExposedReference 是一个泛型类型,可用于创建对场景对象的引用,以及通过使用上下文对象在运行时解析它们的实际值。ScriptableObjectPlayableAsset 等资源可使用它来创建对场景对象的引用。

using UnityEngine;

public class CameraSwitcher : StandardAsset { public ExposedReference<Camera> theSceneCamera;

public override void PrepareFrame(FrameData frameData) { var sceneCamera = theSceneCamera.Resolve(frameData.exposedPropertyResolver); } }

In this example, we have an asset that needs to save a reference to a scene object, in this case a camera. The ExposedProperty generic is used to define the field, and at runtime its actual value is fetched by passing the ExposedPropertyResolver.

变量

defaultValue默认值,以防无法解析该值。
exposedNameExposedReference 的名称。

公共函数

Resolve根据 ExposedPropertyResolver 上下文对象,通过解析此引用的值来获取该值。