Created
January 17, 2018 20:18
-
-
Save Dreezn/d6a9aa2ea7988fb2527b920b9f295dc5 to your computer and use it in GitHub Desktop.
The Mysterious GatherProperties override
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//[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