Class RandomTargetSelector
Selects a random UnityEngine.GameObject from all within a given radius and layer mask. Useful for random targeting effects or abilities.
[Serializable]
public class RandomTargetSelector : TargetSelector
- Inheritance
-
RandomTargetSelector
- Inherited Members
Fields
MaxHits
Maximum number of hits to process.
[Tooltip("Maximum number of hits to process.")]
[Min(1)]
public int MaxHits
Field Value
Radius
Radius to search for targets.
[Tooltip("Radius to search for targets.")]
[Min(0)]
public float Radius
Field Value
TargetLayer
Layer mask to filter targets.
[Tooltip("Layer mask to filter targets.")]
public LayerMask TargetLayer
Field Value
- LayerMask
Methods
SelectTargets(EventData)
Returns a random UnityEngine.GameObject from all within Radius of the context.
public override IEnumerable<GameObject> SelectTargets(EventData eventData)
Parameters
eventDataEventDataThe event driving the selection.
Returns
- IEnumerable<GameObject>
An enumerable containing one random UnityEngine.GameObject, or empty if none found.