Version: Unity 6.3 Beta (6000.3)
Language : English
PlayableGraph, its nodes, and output
Playable Director component

ScriptPlayable and PlayableBehaviour

Use the ScriptPlayable<> object and the PlayableBehaviour custom behavior to create custom playables.

To create your own custom playable, inherit from the PlayableBehaviour base class:

public class MyCustomPlayableBehaviour : PlayableBehaviour
{
    // Implementation of the custom playable behaviour
    // Override PlayableBehaviour methods as needed
}

To use a PlayableBehaviour as a custom playable, you must wrap it within a ScriptPlayable<> object. If you don’t have an instance of your custom playable, use the following code to create a ScriptPlayable:

ScriptPlayable<MyCustomPlayableBehaviour>.Create(playableGraph);

If you have an instance of your custom playable, use the following code to wrap the instance in a ScriptPlayable<> object:

MyCustomPlayableBehaviour myPlayable = new MyCustomPlayableBehaviour();
ScriptPlayable<MyCustomPlayableBehaviour>.Create(playableGraph, myPlayable);

This clones the instance and assigns the clone to the ScriptPlayable object. In this example, use the myPlayable public property in the InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
See in Glossary
window to configure a different behaviour for each instance of your script.

To retrieve the PlayableBehaviour object from the ScriptPlayable object, use the ScriptPlayable<T> .GetBehaviour() method.

Additional resources

PlayableGraph, its nodes, and output
Playable Director component
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961