Static helper class for finding components based on distance. More...
Static Public Member Functions | |
| static T | GetNearest< T > (Vector3 position) |
| Finds the nearest component of type T from the specified position. | |
| static T | GetNearest< T > (Transform from) |
| Finds the nearest component of type T from the specified transform. | |
| static T | GetNearest< T > (Vector3 position, float maxDistance) |
| Finds the nearest component of type T within the specified maximum distance. | |
| static T | GetNearestIncludingChildren< T > (Vector3 position) |
| Finds the nearest component of type T from the specified position, including in children. | |
| static T | GetNearestIncludingChildren< T > (Transform from) |
| Finds the nearest component of type T from the specified transform, including in children. | |
| static T | GetNearestIncludingChildren< T > (Vector3 position, float maxDistance) |
| Finds the nearest component of type T within the specified maximum distance, including in children. | |
| static Component | GetNearestIncludingChildren (Vector3 position, float maxDistance, Type componentType) |
| Finds the nearest component of specific type within the specified maximum distance, including in children. | |
| static List< T > | GetNearestMultiple< T > (Vector3 position, int count) |
| Finds the N nearest components of type T from the specified position. | |
| static List< T > | GetNearestMultipleIncludingChildren< T > (Vector3 position, int count) |
| Finds the N nearest components of type T from the specified position, including in children. | |
| static List< T > | GetNearestMultiple< T > (Vector3 position, int count, float maxDistance) |
| Finds the N nearest components of type T within the specified maximum distance. | |
| static List< T > | GetNearestMultipleIncludingChildren< T > (Vector3 position, int count, float maxDistance) |
| Finds the N nearest components of type T within the specified maximum distance, including in children. | |
| static List< T > | GetAllInRadius< T > (Vector3 position, float radius) |
| Finds all components of type T within the specified radius. | |
| static List< T > | GetAllInRadiusIncludingChildren< T > (Vector3 position, float radius) |
| Finds all components of type T within the specified radius, including in children. | |
| static DistanceTarget | GetNearest (Vector3 position, string typeIdentifier) |
| Finds the nearest DistanceTarget with the specified type identifier. | |
| static DistanceTarget | GetNearest (Vector3 position, string typeIdentifier, float maxDistance) |
| Finds the nearest DistanceTarget with the specified type identifier within maximum distance. | |
| static List< DistanceTarget > | GetAllInRadius (Vector3 position, float radius, string typeIdentifier) |
| Finds all DistanceTarget components with the specified type identifier within radius. | |
| static bool | ExistsInRadius< T > (Vector3 position, float radius) |
| Checks if a component of type T exists within the specified radius. | |
| static float | GetDistanceToNearest< T > (Vector3 position) |
| Gets the distance to the nearest component of type T, returns -1 if none found. | |
| static void | ForceRefresh () |
| Forces a refresh of all DistanceTarget components (useful in editor) | |
Detailed Description
Static helper class for finding components based on distance.
Works with components marked with DistanceTarget. Provides spatial queries to find nearest components of specific types in both editor and runtime.
Member Function Documentation
◆ ExistsInRadius< T >()
|
static |
Checks if a component of type T exists within the specified radius.
- Type Constraints
-
T : Component
◆ ForceRefresh()
|
static |
Forces a refresh of all DistanceTarget components (useful in editor)
◆ GetAllInRadius()
|
static |
Finds all DistanceTarget components with the specified type identifier within radius.
◆ GetAllInRadius< T >()
|
static |
Finds all components of type T within the specified radius.
- Type Constraints
-
T : Component
◆ GetAllInRadiusIncludingChildren< T >()
|
static |
Finds all components of type T within the specified radius, including in children.
- Type Constraints
-
T : Component
◆ GetDistanceToNearest< T >()
|
static |
Gets the distance to the nearest component of type T, returns -1 if none found.
- Type Constraints
-
T : Component
◆ GetNearest() [1/2]
|
static |
Finds the nearest DistanceTarget with the specified type identifier.
◆ GetNearest() [2/2]
|
static |
Finds the nearest DistanceTarget with the specified type identifier within maximum distance.
◆ GetNearest< T >() [1/3]
|
static |
Finds the nearest component of type T from the specified transform.
- Type Constraints
-
T : Component
◆ GetNearest< T >() [2/3]
|
static |
Finds the nearest component of type T from the specified position.
- Type Constraints
-
T : Component
◆ GetNearest< T >() [3/3]
|
static |
Finds the nearest component of type T within the specified maximum distance.
- Type Constraints
-
T : Component
◆ GetNearestIncludingChildren()
|
static |
Finds the nearest component of specific type within the specified maximum distance, including in children.
◆ GetNearestIncludingChildren< T >() [1/3]
|
static |
Finds the nearest component of type T from the specified transform, including in children.
- Type Constraints
-
T : Component
◆ GetNearestIncludingChildren< T >() [2/3]
|
static |
Finds the nearest component of type T from the specified position, including in children.
- Type Constraints
-
T : Component
◆ GetNearestIncludingChildren< T >() [3/3]
|
static |
Finds the nearest component of type T within the specified maximum distance, including in children.
- Type Constraints
-
T : Component
◆ GetNearestMultiple< T >() [1/2]
|
static |
Finds the N nearest components of type T from the specified position.
- Type Constraints
-
T : Component
◆ GetNearestMultiple< T >() [2/2]
|
static |
Finds the N nearest components of type T within the specified maximum distance.
- Type Constraints
-
T : Component
◆ GetNearestMultipleIncludingChildren< T >() [1/2]
|
static |
Finds the N nearest components of type T from the specified position, including in children.
- Type Constraints
-
T : Component
◆ GetNearestMultipleIncludingChildren< T >() [2/2]
|
static |
Finds the N nearest components of type T within the specified maximum distance, including in children.
- Type Constraints
-
T : Component