{"id":26097718,"url":"https://github.com/alex-rachel/gameplaytags","last_synced_at":"2025-07-28T14:34:12.583Z","repository":{"id":280236200,"uuid":"941126241","full_name":"Alex-Rachel/GameplayTags","owner":"Alex-Rachel","description":"A High performance of GameplayTags implementation.","archived":false,"fork":false,"pushed_at":"2025-03-02T06:25:40.000Z","size":115,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T07:22:18.065Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Alex-Rachel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-01T14:54:47.000Z","updated_at":"2025-03-21T09:15:20.000Z","dependencies_parsed_at":"2025-03-02T07:24:08.004Z","dependency_job_id":"ed1be098-8937-4ffe-8e67-8ae06378f98a","html_url":"https://github.com/Alex-Rachel/GameplayTags","commit_stats":null,"previous_names":["alex-rachel/gameplaytags"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alex-Rachel%2FGameplayTags","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alex-Rachel%2FGameplayTags/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alex-Rachel%2FGameplayTags/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alex-Rachel%2FGameplayTags/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Alex-Rachel","download_url":"https://codeload.github.com/Alex-Rachel/GameplayTags/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248569016,"owners_count":21126153,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-09T15:34:31.781Z","updated_at":"2025-04-12T12:42:22.996Z","avatar_url":"https://github.com/Alex-Rachel.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GameplayTags\n[![license](https://img.shields.io/github/license/Alex-Rachel/GameplayTags.svg)](https://github.com/Alex-Rachel/GameplayTags/blob/main/LICENSE) \n[![last](https://img.shields.io/github/last-commit/Alex-Rachel/GameplayTags.svg)](https://github.com/Alex-Rachel/GameplayTags)\n[![issue](https://img.shields.io/github/issues/Alex-Rachel/GameplayTags.svg)](https://github.com/Alex-Rachel/GameplayTags/issues)\n[![topLanguage](https://img.shields.io/github/languages/top/Alex-Rachel/GameplayTags.svg)](https://github.com/Alex-Rachel/GameplayTags)\n\n\nGameplayTags for C#/Unity. \n\nA A High performance of GameplayTags implementation for C# or Unity. Gameplay tags are a flexible and efficient way to handle and categorize gameplay-related properties and states.\n\n## As U Know\nGameplayTag :Gameplaytag can extend a lot of functionality. It`s a struct that optimizes network transport with runtimeindex. U Must Need Define in Code. It Could not add a define in runtime.\n\nGameplayTagContainer: It's a container that you'll usually use in your game, and it holds a collection of GamePlaytags on this object.\n\n## Basic Usage\n\nGameplay tags are registered through attributes in the assembly. Here is an example:\n\n```csharp\n// Need Define in Code.\n[assembly: GameplayTag(\"Ability\")]\n[assembly: GameplayTag(\"Ability.CanAttack\")]\n[assembly: GameplayTag(\"Ability.CanAttack.CanCrit\")]\n[assembly: GameplayTag(\"Ability.CanHurt\")]\n[assembly: GameplayTag(\"State\")]\n[assembly: GameplayTag(\"State.Buff\")]\n[assembly: GameplayTag(\"State.DeBuff\")]\n[assembly: GameplayTag(\"State.Buff.AddAttribute\")]\n[assembly: GameplayTag(\"State.DeBuff.DeAttribute\")]\n```\n### GameplayTagCountContainer\n\n`GameplayTagCountContainer` is a class used to manage gameplay tags with event callbacks for tag count changes. Here’s how to use it:\n\n#### Creating a Tag Container\n\n```csharp\nGameplayTagCountContainer tagContainer = new GameplayTagCountContainer();\n```\n#### Adding a Tag To Container\n\n```csharp\nGameplayTag tag = GameplayTagManager.RequestTag(\"ExampleTag\");\ntagContainer.AddTag(tag);\n```\n\n#### Removing a Tag\n\n```csharp\ntagContainer.RemoveTag(tag);\n```\n\n#### Registering a Callback for Tag Changes\n\n```csharp\nvoid OnTagChanged(GameplayTag tag, int newCount)\n{\n    Debug.Log($\"Tag {tag.Name} count changed to {newCount}\");\n}\n\ntagContainer.RegisterTagEventCallback(tag, GameplayTagEventType.AnyCountChange, OnTagChanged);\n```\n\n#### Removing a Callback\n\n```csharp\ntagContainer.RemoveTagEventCallback(tag, GameplayTagEventType.AnyCountChange, OnTagChanged);\n```\n\n#### Querying the Count of a Tag\n\n```csharp\nint tagCount = tagContainer.GetTagCount(tag);\nDebug.Log($\"Tag {tag.Name} has a count of {tagCount}\");\n```\n\n#### Clearing All Tags\n\n```csharp\ntagContainer.Clear();\n```\n\n### GameplayTagContainer\n\n`GameplayTagContainer` is a class for storing a collection of gameplay tags. It is serializable and provides a user-friendly interface in the Unity editor.\n\n#### Creating a Tag Container\n\n```csharp\nGameplayTagContainer tagContainer = new GameplayTagContainer();\n```\n\n#### Adding a Tag\n\n```csharp\nGameplayTag tag = GameplayTagManager.RequestTag(\"ExampleTag\");\ntagContainer.AddTag(tag);\n// or \ntagContaier.AddTag(\"ExampleTag\");\n```\n\n#### Removing a Tag\n\n```csharp\ntagContainer.RemoveTag(tag);\n```\n\n#### Clearing All Tags\n\n```csharp\ntagContainer.Clear();\n```\n\n### Union and Intersection Operations\n\nUnion and intersection operations can be performed on any type of container that implements `IGameplayTagContainer`. These operations can be used to create new `GameplayTagContainer` instances.\n\n#### Creating a Union of Tag Containers\n\n```csharp\nGameplayTagContainer union = GameplayTagContainer.Union(container1, container2);\n```\n\n#### Creating an Intersection of Tag Containers\n\n```csharp\nGameplayTagContainer intersection = GameplayTagContainer.Intersection(container1, container2);\n```\n\n## Differences between GameplayTagCountContainer and GameplayTagContainer\n\n- **GameplayTagCountContainer**: Focuses on managing tags with the ability to register callbacks for when tag counts change. It is useful when you need to respond to tag count changes.\n- **GameplayTagContainer**: Designed to store a collection of tags, it is serializable and offers a user-friendly interface in the Unity editor. It provides basic tag management without the event-driven functionality of `GameplayTagCountContainer`.\n\n## AllGameplayTags Generated Class\n\nA Source Generator provides access to any gameplay tag declared within the current assembly without requiring a dedicated field to store the tag value. This approach eliminates the need to repeatedly call `GameplayTagManager.RequestTag`. For example, the gameplay tag \"A.B.C\" can be accessed through `AllGameplayTags.A.B.C.Get()`, simplifying tag retrieval and enhancing performance by avoiding redundant tag requests. [Read More](Documentation~/CodeGeneration.md).\n\n\n## Thanks for GameplayTags of BandoWare. This Project base of it.\nGameplayTags:https://github.com/BandoWare/GameplayTags\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex-rachel%2Fgameplaytags","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falex-rachel%2Fgameplaytags","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falex-rachel%2Fgameplaytags/lists"}