Skip to content

Instantly share code, notes, and snippets.

@Dreezn
Created January 17, 2018 20:18
Show Gist options
  • Save Dreezn/d6a9aa2ea7988fb2527b920b9f295dc5 to your computer and use it in GitHub Desktop.
Save Dreezn/d6a9aa2ea7988fb2527b920b9f295dc5 to your computer and use it in GitHub Desktop.
The Mysterious GatherProperties override
//[Omitted...]
public class CustomTransformationTrack : TrackAsset
{
//[Omitted...]
public override void GatherProperties(PlayableDirector director, IPropertyCollector driver)
{
#if UNITY_EDITOR
Transform trackBinding = director.GetGenericBinding(this) as Transform;
if (trackBinding == null)
return;
var serializedObject = new UnityEditor.SerializedObject(trackBinding);
var iterator = serializedObject.GetIterator();
while (iterator.NextVisible(true))
{
if (iterator.hasVisibleChildren)
continue;
driver.AddFromName<Transform>(trackBinding.gameObject, iterator.propertyPath);
}
#endif
base.GatherProperties(director, driver);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment