Sequencer attach tracks are not applied consistently

Hello!

In a sequence structure where there is a spawnable in a root sequence with an attach track and a subsequence containing a possessable bound to the spawnable with its own attach track, we’re finding that sometimes the attach track in the root is applied and other times the attach track in the sub sequence is applied.

(The reason we have structure our sequences like this is that we would like the spawnable actor to have a default attachment; however, some shot sequences may want to temporarily override that by adding an attach track of their own.)

In `FAttachmentHandler::UpdateOutput` the `Inputs` seem to be unsorted, but the first input is always the attachment that is applied. In the above configuration, sometimes the input created by the attach section in the root sequence will come first and other times the input created by the attach section in the sub sequence will come first meaning that we don’t know which attach section will take effect.

We’re evaluating making a change to that function to select the input with the largest hierarchical bias so that attach sections in sub sequences that are deeper in the hierarchy have precedence over those higher in the hierarchy. It would look something like this:

FMovieSceneEntityID Entity;
TOptional<int16> MaxHierarchicalBias;
for (FMovieSceneEntityID Input : Inputs)
{
	TOptionalComponentReader<int16> HierarchicalBias = EntityManager->ReadComponent(Input, BuiltInComponents->HierarchicalBias);
	if (!MaxHierarchicalBias.IsSet() || (HierarchicalBias && *HierarchicalBias > MaxHierarchicalBias.GetValue()))
	{
		MaxHierarchicalBias = HierarchicalBias ? *HierarchicalBias : 0;
		Entity = Input;
	}
}
 
if (Entity.IsValid())
{
	// Apply attachment
}

I’m wondering if this is a change that Epic would consider adding to Unreal, or if there is an alternate approach we could use to give one attach section precedence over another? (I looked into `UMovieSceneSection::OverlapPriority` but it doesn’t seem to impact the order of the inputs).

Thanks,

Scott

Steps to Reproduce

Hey there,

We have a bunch of folks out on holiday, once I can get this in the right hands we’ll let you know.

Dustin

Hi there, sorry for the delays. So your workaround should indeed work, and is probably best for you. We did fix it differently however to be more idiomatic and consistent with the rest of the Sequencer evaluation logic.

Basically, there is already an ECS Hierarchical Bias system that’s meant to compare h-bias values and tag entities as “Ignored” when they don’t have the highest one. So in theory, the fix would be to simply ignored entities with that tag. However, the Hierarchical Bias system uses “groups”, from the Grouping System, in order to know what are entities that are “animating the same thing”. The reason for this separation is that we don’t want the Hierarchical Bias system to be aware of the details for what that means, such as “bound object + animated property” or “bound material + parameter name” or whatever else. So other systems define these rules for grouping, and then for hbias we just look at all the groups and tag anything in each group that doesn’t have the highest value. So long story short: we need to define a grouping policy for attachments.

The fix is currently being tested by QA so take it with a pinch of salt but it’s here: https://github.com/EpicGames/UnrealEngine/commit/8a985de12368f8542fb6e7dc4d2447683e6557e6

Great, thanks a lot!