Gameplay cameras - setting transitions on rigs based on gameplay tags doesnt work properly

When I created a camera rig transition with Gameplay tag condition, I noticed that the transition will be used even if the gameplay tags do not match. I think it is because the variables bPreviousMatches and bNextMatches are true even if the query doesnt match

`bool UGameplayTagTransitionCondition::OnTransitionMatches(const FCameraRigTransitionConditionMatchParams& Params) const
{
bool bPreviousMatches = true;

if (!PreviousGameplayTagQuery.IsEmpty())
{
    if (Params.FromCameraRig)
    {
        FGameplayTagContainer TagContainer;
        Params.FromCameraRig->GetOwnedGameplayTags(TagContainer);
        if (TagContainer.MatchesQuery(PreviousGameplayTagQuery))
        {
            bPreviousMatches = true;
        }
    }
    else
    {
        bPreviousMatches = false;
    }
}

bool bNextMatches = true;

if (!NextGameplayTagQuery.IsEmpty())
{
    if (Params.ToCameraRig)
    {
        FGameplayTagContainer TagContainer;
        Params.ToCameraRig->GetOwnedGameplayTags(TagContainer);
        if (TagContainer.MatchesQuery(NextGameplayTagQuery))
        {
            bNextMatches = true;
        }
    }
    else
    {
        bNextMatches = false;
    }
}

return bPreviousMatches && bNextMatches;

}

-------------------- Suggested fix: ----------------------------------
bool UGameplayTagTransitionCondition::OnTransitionMatches(const FCameraRigTransitionConditionMatchParams& Params) const
{
bool bPreviousMatches = false;

if (!PreviousGameplayTagQuery.IsEmpty())
{
    if (Params.FromCameraRig)
    {
        FGameplayTagContainer TagContainer;
        Params.FromCameraRig->GetOwnedGameplayTags(TagContainer);
        if (TagContainer.MatchesQuery(PreviousGameplayTagQuery))
        {
            bPreviousMatches = true;
        }
    }
}

bool bNextMatches = false;

if (!NextGameplayTagQuery.IsEmpty())
{
    if (Params.ToCameraRig)
    {
        FGameplayTagContainer TagContainer;
        Params.ToCameraRig->GetOwnedGameplayTags(TagContainer);
        if (TagContainer.MatchesQuery(NextGameplayTagQuery))
        {
            bNextMatches = true;
        }
    }
}
return bPreviousMatches && bNextMatches;

}`

Steps to Reproduce
Create two camera rigs and add a custom transition between them with Gameplay tag condition

[Image Removed]

Set the transition to be used only when some gameplay tags on the rigs match

[Image Removed]

The transition will be used even when the tags dont match

Ah yes, sorry about this, my code is indeed wrong.

I don’t think your fix is exactly correct though? The goal is that if a tag query is empty, it should always pass (so that you can use this condition with only one tag query on either previous or next rig, not always both)

So I think it’s maybe this?

`bool UGameplayTagTransitionCondition::OnTransitionMatches(const FCameraRigTransitionConditionMatchParams& Params) const
{
bool bPreviousMatches = true;

if (!PreviousGameplayTagQuery.IsEmpty())
{
bPreviousMatches = false;

if (Params.FromCameraRig)
{
FGameplayTagContainer TagContainer;
Params.FromCameraRig->GetOwnedGameplayTags(TagContainer);
if (TagContainer.MatchesQuery(PreviousGameplayTagQuery))
{
bPreviousMatches = true;
}
}
}

bool bNextMatches = true;

if (!NextGameplayTagQuery.IsEmpty())
{
bNextMatches = false;

if (Params.ToCameraRig)
{
FGameplayTagContainer TagContainer;
Params.ToCameraRig->GetOwnedGameplayTags(TagContainer);
if (TagContainer.MatchesQuery(NextGameplayTagQuery))
{
bNextMatches = true;
}
}
}

return bPreviousMatches && bNextMatches;
}`

Good point, thanks for the answer.

The fix will be in 5.6.1, thanks again for reporting this!