| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 | using UnityEngine;using UnityEngine.Playables;[System.Serializable]public class ActiveGameObjectPlayableBehaviour : PlayableBehaviour{    public bool isActive;        public GameObject gameObject;    public bool isLasting;    // Called when the owning graph starts playing    public override void OnGraphStart(Playable playable)    {        Debug.Log("OnGraphStart");    }    // Called when the owning graph stops playing    public override void OnGraphStop(Playable playable)    {        Debug.Log("OnGraphStop");    }    // Called when the state of the playable is set to Play    public override void OnBehaviourPlay(Playable playable, FrameData info)    {               Debug.Log("OnBehaviourPlay");        if (gameObject != null)        {            gameObject.SetActive(isActive);        }    }    // Called when the state of the playable is set to Paused    public override void OnBehaviourPause(Playable playable, FrameData info)    {        if (gameObject != null)        {            if (!isLasting)            {                gameObject.SetActive(!isActive);            }        }        Debug.Log("OnBehaviourPause");    }    // Called each frame while the state is set to Play    public override void PrepareFrame(Playable playable, FrameData info)    {        // Debug.Log("PrepareFrame" + info.weight);    }}
 |