I wandered around the Playable API amusement park with joy and arrived at a booth called TrackActions. After convincing the guy at the booth to let me play, I created an action to create custom sub-tracks for my custom track. So far so good.
Sadly, I now realized that the SupportsChildTracksAttribute does not allow for multiples. Are there any deeper limitations on why only a single type of sub-track should be supported?
I experimented with adjusting TimelineCreateUtilities.ValidateParentTrack to allow for multiple SupportsChildTracksAttribute applications and it appears to work.
Here’s the relevant part of what I needed to change in TimelineCreateUtilities.ValidateParentTrack:
foreach (var attr in Attribute.GetCustomAttributes(parent.GetType(), typeof(SupportsChildTracksAttribute)).OfType<SupportsChildTracksAttribute>())
{
// group track case, accepts all
if (attr.childType == null)
return true;
// specific case. Specifies nesting level
if (childType == attr.childType)
{
int nestCount = 0;
var p = parent;
while (p != null && p.isSubTrack)
{
nestCount++;
p = p.parent as TrackAsset;
}
return nestCount < attr.levels;
}
}
Also, convincing the guy at the booth is one thing, messing with his stuff another. Is it possible to let SupportsChildTracksAttribute support multiples in the future? ![]()