- Tags can be defined at runtime, no need to maintain a canonical list.
- Objects can have multiple tags associated with them, leave layers for rendering & physics
- Case insensitive
- Import BetterTags into your project
- On objects you want to tag, add a BetterUtils.Tag component
- Add whatever initial tags you want to the Tag List property
Adding/removing/checking tags:
using BetterTag;
var go = <some game object>;
go.AddTag("my_new_tag");
go.RemoveTag("some_other_tag");
if(go.HasTag("conditional_tag")) {
DoSomething();
}
Finding things by tag:
using BetterTag;
GameObject obj = TagSystem.GameObjectForTag("other_tag_to_find");
List<GameObject> objs = TagSystem.AllGameObjectsForTag("tag_to_find");
All code available under the MIT license
Questions/Comments? Hit me up on twitter: @rje
Fixes or feature additions? Send a pull request, happy to integrate them!