Utility functions for working with GameObjects.
More...
Utility functions for working with GameObjects.
◆ DoesGameObjectPathMatch()
static bool PixelCrushers.GameObjectUtility.DoesGameObjectPathMatch |
( |
Transform |
t, |
|
|
string |
requiredPath |
|
) |
| |
|
inlinestatic |
Returns true if the end of a transform's hierarchy path matches a specified path.
For example, if the transform's hierarchy is A/B/C/D, it will match a requiredPath of C/D.
◆ FindFirstObjectByType()
static UnityEngine.Object PixelCrushers.GameObjectUtility.FindFirstObjectByType |
( |
System::Type |
type | ) |
|
|
inlinestatic |
◆ FindFirstObjectByType< T >()
◆ FindObjectsByType()
static UnityEngine.Object[] PixelCrushers.GameObjectUtility.FindObjectsByType |
( |
System::Type |
type | ) |
|
|
inlinestatic |
◆ FindObjectsByType< T >()
◆ FindObjectsOfTypeAlsoInactive< T >()
static T[] PixelCrushers.GameObjectUtility.FindObjectsOfTypeAlsoInactive< T > |
( |
bool |
checkAllScenes = true | ) |
|
|
inlinestatic |
Finds all objects of a type, including on inactive GameObjects.
- Parameters
-
checkAllScenes | If true, check all open scenes; otherwise only check active scene. |
◆ GameObjectHardFind() [1/2]
static GameObject PixelCrushers.GameObjectUtility.GameObjectHardFind |
( |
string |
goName, |
|
|
bool |
checkAllScenes = true |
|
) |
| |
|
inlinestatic |
Finds an in-scene GameObject by name even if it's inactive.
- Parameters
-
goName | Name of the GameObject. |
checkAllScenes | If true, check all open scenes; otherwise only check active scene. |
- Returns
- The GameObject.
◆ GameObjectHardFind() [2/2]
static GameObject PixelCrushers.GameObjectUtility.GameObjectHardFind |
( |
string |
goName, |
|
|
string |
tag, |
|
|
bool |
checkAllScenes = true |
|
) |
| |
|
inlinestatic |
Finds an in-scene GameObject by name and tag even if it's inactive.
- Parameters
-
goName | GameObject name to search for. |
tag | Tag to search for. |
checkAllScenes | If true, check all open scenes; otherwise only check active scene. |
- Returns
◆ GetComponentAnywhere< T >()
static T PixelCrushers.GameObjectUtility.GetComponentAnywhere< T > |
( |
GameObject |
gameObject | ) |
|
|
inlinestatic |
Like GetComponentInChildren(), but also searches parents.
- Returns
- The component, or
null
if not found.
- Parameters
-
gameObject | Game object to search. |
- Template Parameters
-
◆ GetGameObjectHeight()
static float PixelCrushers.GameObjectUtility.GetGameObjectHeight |
( |
GameObject |
gameObject | ) |
|
|
inlinestatic |
Gets the height of the game object based on its collider.
This only works if the game object has a CharacterController, CapsuleCollider, BoxCollider, or SphereCollider.
- Returns
- The game object height if it has a recognized type of collider; otherwise
0
.
- Parameters
-
◆ GetHierarchyPath()
static string PixelCrushers.GameObjectUtility.GetHierarchyPath |
( |
Transform |
t | ) |
|
|
inlinestatic |
Returns the full hierarchy path.
- Parameters
-
- Returns
◆ IsPrefab()
static bool PixelCrushers.GameObjectUtility.IsPrefab |
( |
GameObject |
go | ) |
|
|
inlinestatic |
Determines if a GameObject reference is a non-instantiated prefab or a scene object.
If go
is null
, active in the scene, or its parent is active in the scene, it's considered a scene object. Otherwise this method searches all scene objects for matches. If it doesn't find any matches, this is a prefab.
- Returns
true
if a prefab; otherwise, false
.
- Parameters
-
The documentation for this class was generated from the following file:
- C:/Dev/Quest Machine/Dev/Source/Assets/Plugins/Pixel Crushers/Common/Scripts/Misc/GameObjectUtility.cs