Skip to content

GameplayTagContainerExtensionMethods.HasAny doesn't work correctly #19

@rurumi0318

Description

@rurumi0318

Define tags

[assembly: GameplayTag("Tile.Obstacle")]
[assembly: GameplayTag("Tile.Walkway")]
[assembly: GameplayTag("Tile.Walkway.Start")]
[assembly: GameplayTag("Tile.Walkway.End")]
[assembly: GameplayTag("Tile.Link.Source")]
[assembly: GameplayTag("Tile.Link.Target")]
[assembly: GameplayTag("Tile.PatrolPath")]
[assembly: GameplayTag("Tile.PatrolPath.Start")]
[assembly: GameplayTag("Tile.Negative.Item_A")]
[assembly: GameplayTag("Tile.Positive.Item_B")]

Test code

public class TestHasAny : MonoBehaviour
{
    private void Start()
    {
        var container1 = new GameplayTagContainer();
        container1.AddTag(AllGameplayTags.Tile.Walkway.Get());
        container1.AddTag(AllGameplayTags.Tile.Negative.Item_A.Get());

        var blockingContainer = new GameplayTagContainer();
        blockingContainer.AddTag(AllGameplayTags.Tile.Walkway.Start.Get());
        blockingContainer.AddTag(AllGameplayTags.Tile.Walkway.End.Get());
        blockingContainer.AddTag(AllGameplayTags.Tile.Obstacle.Get());
        blockingContainer.AddTag(AllGameplayTags.Tile.Link.Get());
        blockingContainer.AddTag(AllGameplayTags.Tile.PatrolPath.Get());
        blockingContainer.AddTag(AllGameplayTags.Tile.Negative.Get());
        blockingContainer.AddTag(AllGameplayTags.Tile.Positive.Get());

        bool result = container1.HasAny(blockingContainer);

        Debug.Log($"container1 has blocking tags: {result}");
    }
}

The result is false, it can't find the container has Tile.Negative.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions