Skip to content

PreviewBoundsCalculator

ClassAssetInventoryAssetInventory.Editor
public static class PreviewBoundsCalculator

Centralized bounds calculation for all preview types. Consolidates bounds logic from PreviewManager and CustomPrefabPreviewGenerator.

GetBoundsOverTime(Renderer[], PrefabType, float, GameObject)

Section titled “GetBoundsOverTime(Renderer[], PrefabType, float, GameObject)”
public static Bounds GetBoundsOverTime(Renderer[] renderers, CustomPrefabPreviewGenerator.PrefabType prefabType, float animationDuration, GameObject prefab = null)

Get bounds based on prefab type, handling static and animated content

Parameters

Name Type Description
renderers UnityEngine.Renderer[]
prefabType AssetInventory.CustomPrefabPreviewGenerator.PrefabType
animationDuration System.Single
prefab UnityEngine.GameObject

Returns

UnityEngine.Bounds — No return description is available.

GetGlobalBounds(Renderer[], PrefabType, GameObject)

Section titled “GetGlobalBounds(Renderer[], PrefabType, GameObject)”
public static Bounds GetGlobalBounds(Renderer[] renderers, CustomPrefabPreviewGenerator.PrefabType prefabType = PrefabType.Model, GameObject prefabObject = null)

Get global bounds from renderers (works for scenes, prefabs, and static objects)

Parameters

Name Type Description
renderers UnityEngine.Renderer[]
prefabType AssetInventory.CustomPrefabPreviewGenerator.PrefabType
prefabObject UnityEngine.GameObject

Returns

UnityEngine.Bounds — No return description is available.

public static Bounds GetCurrentParticleBounds(GameObject go)

Get current particle bounds based on live particle positions

Parameters

Name Type Description
go UnityEngine.GameObject

Returns

UnityEngine.Bounds — No return description is available.

GetParticleBoundsOverTime(GameObject, float, int)

Section titled “GetParticleBoundsOverTime(GameObject, float, int)”
public static Bounds GetParticleBoundsOverTime(GameObject go, float duration, int sampleCount = 10)

Get particle bounds over time by simulating at multiple time points

Parameters

Name Type Description
go UnityEngine.GameObject
duration System.Single
sampleCount System.Int32

Returns

UnityEngine.Bounds — No return description is available.

public static Bounds GetVFXBoundsOverTime(GameObject go, float duration)

No description is available for this member.

Parameters

Name Type Description
go UnityEngine.GameObject
duration System.Single

Returns

UnityEngine.Bounds — No return description is available.

GetFBXAnimationBoundsOverTime(GameObject, AnimationClip, int)

Section titled “GetFBXAnimationBoundsOverTime(GameObject, AnimationClip, int)”
public static Bounds GetFBXAnimationBoundsOverTime(GameObject go, AnimationClip clip, int sampleCount = 8)

Get FBX animation bounds by sampling across the animation timeline

Parameters

Name Type Description
go UnityEngine.GameObject
clip UnityEngine.AnimationClip
sampleCount System.Int32

Returns

UnityEngine.Bounds — No return description is available.

public static Bounds GetRectTransformBounds(RectTransform rectTransform)

Get RectTransform bounds in world space (for UI elements)

Parameters

Name Type Description
rectTransform UnityEngine.RectTransform

Returns

UnityEngine.Bounds — No return description is available.

public static Bounds GetVisibleUIBounds(GameObject uiPrefab)

Get visible UI bounds, handling ScrollRects and Masks properly. For ScrollRects, uses the viewport bounds instead of extended content. For Masks, uses the mask bounds instead of clipped children.

Parameters

Name Type Description
uiPrefab UnityEngine.GameObject

Returns

UnityEngine.Bounds — No return description is available.

public static Bounds GetFBXMeshBounds(Renderer[] renderers)

Get optimized bounds for FBX models by comparing mesh geometry vs renderer bounds Uses mesh bounds when they provide better framing, with fallback to renderer bounds

Parameters

Name Type Description
renderers UnityEngine.Renderer[]

Returns

UnityEngine.Bounds — No return description is available.