using UnityEditor; using UnityEngine; using UnityEngine.Playables; using UnityEngine.Timeline; namespace UnityUIPlayables { public abstract class AnimationTrack : TrackAsset where TAnimationMixerBehaviour : AnimationMixerBehaviour, new() where TValueMixer : AnimationMixer, new() where TBinding : Component where TAnimationBehaviour : AnimationBehaviour, new() { public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) { return ScriptPlayable.Create(graph, inputCount); } public override void GatherProperties(PlayableDirector director, IPropertyCollector driver) { #if UNITY_EDITOR var component = director.GetGenericBinding(this) as TBinding; if (component == null) { return; } var so = new SerializedObject(component); var iterator = so.GetIterator(); while (iterator.NextVisible(true)) { if (iterator.hasVisibleChildren) { continue; } driver.AddFromName(component.gameObject, iterator.propertyPath); } #endif base.GatherProperties(director, driver); } } }