GameObjectExt.GetBounds Method

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.

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

Syntax

C#

public static Bounds GetBounds(
	this GameObject self,
	bool forceRecurseIntoChildren
)

Parameters

 

self
Type: GameObject
The GameObject whose Bounds to get
forceRecurseIntoChildren
Type: System.Boolean
Whether to also encapsulate all renderers found in the children no matter if the GameObject has a Renderer component or not

Return Value

Type: Bounds
Bounds in world-space.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type GameObject. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also

Reference

GameObjectExt Class
UltimateXR.Extensions.Unity Namespace