Search Unity

Gizmos/Handles/OnSceneGUI to control values in PlayableBehaviour

Discussion in 'Timeline' started by sabojako, Feb 27, 2018.

  1. sabojako

    sabojako

    Joined:
    Jul 7, 2017
    Posts:
    12
    Hi,

    I'm trying to control a PlayableBehaviour's public values from a OnSceneGUI delegate, in an Editor class.

    For reference, I'm starting from the Light Control Track example in the Default Playables package.

    I'm noticing that the Playable is re-generated automagically whenever I modify the values in the LightControlClip inspector (PlayableAsset) which updates the LightControlBehaviour "template" variable (PlayableBehaviour). In other words, LightControlClip.CreatePlayable() gets called. I can get the values to update from the OnSceneGUI() to the LightControlBehaviour.

    However, I struggle to understand how to tell the Playable system to update/dirty the Playable. What is the proper way of re-generating the Playable from an Editor class which inspect a PlayableAsset? Find the source PlayableDirector and RebuildGraph() ?