Version: 2017.1

ExposedReference<T0>

struct in UnityEngine

マニュアルに切り替える

説明

Creates a type whos value is resolvable at runtime.

ExposedReference is a generic type that can be used to create references to scene objects and resolve their actual values at runtime and by using a context object. This can be used by assets, such as a ScriptableObject or PlayableAsset to create references to scene objects.

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.

変数

defaultValueThe default value, in case the value cannot be resolved.
exposedNameThe name of the ExposedReference.

Public 関数

ResolveGets the value of the reference by resolving it given the ExposedPropertyResolver context object.