Class PrefabControlPlayable
Playable that controls and instantiates a Prefab.
Inherited Members
Namespace: UnityEngine.Timeline
Assembly: Unity.Timeline.dll
Syntax
public class PrefabControlPlayable : PlayableBehaviour, IPlayableBehaviour, ICloneable
Properties
prefabInstance
The instance of the prefab created by this behaviour
Declaration
public GameObject prefabInstance { get; }
Property Value
Type | Description |
---|---|
GameObject |
Methods
Create(PlayableGraph, GameObject, Transform)
Creates a Playable with a PrefabControlPlayable behaviour attached
Declaration
public static ScriptPlayable<PrefabControlPlayable> Create(PlayableGraph graph, GameObject prefabGameObject, Transform parentTransform)
Parameters
Type | Name | Description |
---|---|---|
PlayableGraph | graph | The PlayableGraph to inject the Playable into. |
GameObject | prefabGameObject | The prefab to instantiate from |
Transform | parentTransform | Transform to parent instance to. Can be null. |
Returns
Type | Description |
---|---|
ScriptPlayable<PrefabControlPlayable> | Returns a Playabe with PrefabControlPlayable behaviour attached. |
Initialize(GameObject, Transform)
Initializes the behaviour with a prefab and parent transform
Declaration
public GameObject Initialize(GameObject prefabGameObject, Transform parentTransform)
Parameters
Type | Name | Description |
---|---|---|
GameObject | prefabGameObject | The prefab to instantiate from |
Transform | parentTransform | Transform to parent instance to. Can be null. |
Returns
Type | Description |
---|---|
GameObject | The created instance |
OnBehaviourPause(Playable, FrameData)
This function is called when the Playable play state is changed to PlayState.Paused.
Declaration
public override void OnBehaviourPause(Playable playable, FrameData info)
Parameters
Type | Name | Description |
---|---|---|
Playable | playable | The playable this behaviour is attached to. |
FrameData | info | A FrameData structure that contains information about the current frame context. |
Overrides
OnBehaviourPlay(Playable, FrameData)
This function is called when the Playable play state is changed to Playables.PlayState.Playing.
Declaration
public override void OnBehaviourPlay(Playable playable, FrameData info)
Parameters
Type | Name | Description |
---|---|---|
Playable | playable | The Playable that owns the current PlayableBehaviour. |
FrameData | info | A FrameData structure that contains information about the current frame context. |
Overrides
OnPlayableDestroy(Playable)
This function is called when the Playable that owns the PlayableBehaviour is destroyed.
Declaration
public override void OnPlayableDestroy(Playable playable)
Parameters
Type | Name | Description |
---|---|---|
Playable | playable | The playable this behaviour is attached to. |