创建一个值在运行时可加以解析的类型。
ExposedReference 是一个泛型类型,可用于创建对场景对象的引用,以及通过使用上下文对象在运行时解析它们的实际值。ScriptableObject 或 PlayableAsset 等资源可使用它来创建对场景对象的引用。
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 | 默认值,以防无法解析该值。 |
exposedName | ExposedReference 的名称。 |
Resolve | 根据 ExposedPropertyResolver 上下文对象,通过解析此引用的值来获取该值。 |