ScriptPlayable and PlayableBehaviour
Describes the ScriptPlayable<> object, the PlayableBehaviour custom behavior and how to use them together to create custom playables.
Read time 1 minuteLast updated 20 days ago
Use the object and the custom behavior to create custom playables.
ScriptPlayable<>PlayableBehaviourTo create your own custom playable, inherit from the base class:
PlayableBehaviourpublic class MyCustomPlayableBehaviour : PlayableBehaviour{ // Implementation of the custom playable behaviour // Override PlayableBehaviour methods as needed}
To use a as a custom playable, you must wrap it within a object. If you don’t have an instance of your custom playable, use the following code to create a :
PlayableBehaviourScriptPlayable<>ScriptPlayableScriptPlayable<MyCustomPlayableBehaviour>.Create(playableGraph);
If you have an instance of your custom playable, use the following code to wrap the instance in a object:
ScriptPlayable<>MyCustomPlayableBehaviour myPlayable = new MyCustomPlayableBehaviour();ScriptPlayable<MyCustomPlayableBehaviour>.Create(playableGraph, myPlayable);
This clones the instance and assigns the clone to the object. In this example, use the public property in the Inspector window to configure a different behaviour for each instance of your script.
ScriptPlayablemyPlayableTo retrieve the PlayableBehaviour object from the ScriptPlayable object, use the method.
ScriptPlayable<T> .GetBehaviour()