Class TaggedSceneObjectTargetSelector
Resolves scene UnityEngine.GameObjects by Unity tag at runtime. Designed for asset-based Triggers that need to target one or more pre-tagged scene objects — selectors serialized on ScriptableObject assets cannot hold direct scene references, but they can hold a tag string and resolve it at fire time.
The lookup is scoped to the context's scene (whatever scene the event's Target or Initiator lives in). Results are filtered through this selector's Conditions.
Tag pre-requisite: the tag must exist in Unity's Tag Manager (ProjectSettings > Tags and Layers). Using an unknown tag logs a warning and yields no targets.
[Serializable]
public class TaggedSceneObjectTargetSelector : TargetSelector
- Inheritance
-
TaggedSceneObjectTargetSelector
- Inherited Members
Fields
FirstOnly
When true, yields only the first matching GameObject; otherwise yields all matches.
[Tooltip("Yield only the first matching GameObject. Otherwise yield all matches.")]
public bool FirstOnly
Field Value
Tag
Unity tag to match. Must be defined in the project's Tag Manager.
[Tooltip("Unity tag to match. Must be defined in the project's Tag Manager.")]
public string Tag
Field Value
Methods
SelectTargets(EventData)
Selects targets based on the supplied event context.
public override IEnumerable<GameObject> SelectTargets(EventData eventData)
Parameters
eventDataEventDataThe event data driving the selection. Target (when set) or Initiator typically serves as the spatial origin.
Returns
- IEnumerable<GameObject>
The selected GameObjects.