Skip to content

Tagged component overview

Nectunia edited this page Sep 26, 2020 · 5 revisions

Tagged components are the main elements that will interact with Property components in your scene.
They are components with a TagID field. In the Unity editor, the tagged components will select a Tag. By the Tag they have selected, they will be able to interact with all Property components in the scene wich refered the same Tag.
They should all inherit the class MonoBehaviourTagged.

What is a good tagged component ?

Why inherit MonoBehaviourTagged ?

Easier maintenance
The Tags in the Tag window are link to MonoBehaviourTagged components. When a scene is opening in the editor or when a Tag is modified, all MonoBehaviourTagged components in the scene will check if they have to be updated to match their Tag settings. If yes and if they can't be updated automatically, a warning will be sent in the Unity console with a link to the given MonoBehaviourTagged component.

Easier accessibility
MonoBehaviourTagged component provide methods to find them in scene or GameObject. See Find MonoBehaviorTagged