My attempt to replicate Unreal's Gameplay Tags system: https://dev.epicgames.com/documentation/en-us/unreal-engine/gameplay-tags?application_version=4.27
Before building your project make sure that you added your tags container as a preloaded asset, otherwise it will get stripped because there's nothing directly referencing it
You can register tags in two ways: Adding native tag / Manually adding a new tag
You can manipulate tags directly on the ScriptableObject the following way:
1 - Click "Add Root Tag"
2 - Edit Tag Name
3 - Add Subtag
4 - Delete Root/Subtag
To add a native tag you must do that via code the following way:
1 - Locate the NativeGameplayTags class or the one that you created
2 - Add a new const string with the tag name (this const string can be used anywhere in your code to retrieve the tag and avoid typos)
3 - Use the AddNativeTag method from the container to add a new native tag
1 - Native tags cannot be deleted on modified directly on the ScriptableObject, they're readonly
2 - If you add a native tag that already exists inside the container, it will replace the tag by the native one
3 - If you remove a native tag from code, it will not revert as a manual tag, it will just be removed from the container
4 - Native tags can also have child tags both added from the ScriptableObject and from code
Use this component to hold tags related to your GameObjects
You can add Startup Tags and also Add/Remove tags during Runtime
On the Startup Tags you can select any tag from the created ones inside the ScriptableObject (Including native tags) and add as many as you want
You can also add via code during runtime which will then trigger an event so that you can perform actions whenever a tag is added/removed
If you want to select a tag from your custom component you can use the GameplayTagSelector Attribute which allows you to choose a tag to your string field and avoid typos
There's also an extension methods helper class which helps you retrieve/add/remove tags from Objects
[ ] Replace strings by Guids to improve speed and memory usage - I'm still analysing how I'm going to implement this because there's also the possibility of using string interning, which may improve memory usage for the manually added tags inside the ScriptableObject
[ ] Add more tags comparison fuctions inside Gameplay Tags Component