GameObjectExt ClassGameObject extensions.

Inheritance Hierarchy

System.Object
  UltimateXR.Extensions.Unity.GameObjectExt
Namespace: UltimateXR.Extensions.Unity
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0

Syntax

C#

public static class GameObjectExt


The GameObjectExt type exposes the following members.

Methods

NameDescription
Public methodStatic memberCheckSetActive Activates/deactivates the object if it isn’t active already.
Public methodStatic memberCreateGameObjectAndParentSameTransform Creates a new GameObject in the exact same position as the given one and parents it.
Public methodStatic memberGetBounds Calculates the GameObjectBounds. The bounds are the Renderer’s bounds if there is one in the GameObject. Otherwise it will encapsulate all renderers found in the children. If forceRecurseIntoChildren is true, it will also encapsulate all renderers found in the children no matter if the GameObject has a Renderer component or not.
Public methodStatic memberGetGeometricCenter Computes the geometric center of the given GameObject based on all the MeshRenderers in the hierarchy.
Public methodStatic memberGetLocalBounds Calculates the GameObjectBounds in local space. The bounds are the Renderer’s bounds if there is one in the GameObject. Otherwise it will encapsulate all renderers found in the children. If forceRecurseIntoChildren is true, it will also encapsulate all renderers found in the children no matter if the GameObject has a Renderer component or not.
Public methodStatic memberGetOrAddComponent<T> Gets the Component of a given type. If it doesn’t exist, it is added to the GameObject.
Public methodStatic memberGetPathUnderScene Gets the path in the scene of the given GameObject.
Public methodStatic memberGetTopmostCanvas Gets the topmost UxrCanvas upwards in the hierarchy if it exists.
Public methodStatic memberGetUniqueScenePath Gets a unique path in the scene for the given GameObject. It will include sibling indices to make it unique.
Public methodStatic memberIsDynamic Checks whether the given GameObject is dynamic. Since isStatic doesn’t work at runtime due to the static flags being editor-only, a workaround is required to try to find out if an object is dynamic or not.
Public methodStatic memberIsInLayerMask Checks whether the given GameObject’s layer is present in a layer mask.
Public methodStatic memberIsPrefab Checks if the given GameObject is a prefab.
Public methodStatic memberSafeGetComponentInParent<T> Gets the Component of a given type in the GameObject or any of its parents. It also works on prefabs, where regular GetComponentInParent(Type, Boolean) will not work: https://issuetracker.unity3d.com/issues/getcomponentinparent-is-returning-null-when-the-gameobject-is-a-prefab
Public methodStatic memberSetLayerRecursively Sets the layer of a GameObject and all its children.

See Also

Reference

UltimateXR.Extensions.Unity Namespace