AddLinkedStateTreeOverrides and SetLinkedStateTreeOverrides schema validation seems to be reversed

Both the AddLinkedStateTreeOverrides and the SetLinkedStateTreeOverrides methods attempt to validate the schema of the linked state trees, but the logic for doing so seems to be missing a boolean NOT:

if (ItemStateTree->GetSchema() == nullptr
    || ItemStateTree->GetSchema()->GetClass()->IsChildOf(UStateTreeComponentSchema::StaticClass()))
{
    STATETREE_LOG(Warning, TEXT("%hs: Trying to set the linked overrides with the wrong schema. %s."), __FUNCTION__, *ItemStateTree->GetFullName());
    return;
}

That warning will fire anytime the Schema DOES match and the actual assignment will be skipped by the short-circuit return.

This is from the Add version but the Set version has the same check with the same issue.

Steps to Reproduce

  • Create an actor with a StateTreeComponent on it. Assign it a basic state tree with the appropriate schema.
  • Create a second basic state tree with the appropriate schema
  • Call AddLinkedStateTreeOverrides blueprint node, passing in the second state onto the component.
  • Note the log “Trying to set the linked overrides with the wrong schema” despite being the correct schema.

You are correct! We actually committed this change in UE5 Main a couple months ago. Here is a link to the commit on our GitHub: https://github.com/EpicGames/UnrealEngine/commit/f602e71240d38286955b13232cdbb436f3186ada

-James

From what I can see this is still a bug in 5.6.1. Was this part of that release or do I need to upgrade to 5.7+ for this to be resolved?

This is a fix in 5.7. If you build from source, you can cherrypick it into your 5.6 stream. However, if you use the Epic Games Launcher builds, you will need to update to 5.7.

-James

Thanks, James! Confirming this works as expected in 5.7.1.