GameObject myObject = GameObject.Find("My Object"); Bounds worldBounds = Bounds.CalcWorldBounds(myObject.transform); Debug.Log("Minimum world space position: " + worldBounds.min); Debug.Log("Maximum world space position: " + worldBounds.max);
using UnityEngine; using System.Collections.Generic; public class BoundsCalculator : MonoBehaviour { public ListThis code creates a script that calculates the world space boundaries for a list of game objects and logs the results. The script can be attached to any game object in the scene and the objectsToCheck list can be populated in the editor or in code. Package/Library: Unity Engine.objectsToCheck; private void Start() { foreach (GameObject obj in objectsToCheck) { Bounds worldBounds = Bounds.CalcWorldBounds(obj.transform); Debug.Log("Minimum world space position of " + obj.name + ": " + worldBounds.min); Debug.Log("Maximum world space position of " + obj.name + ": " + worldBounds.max); } } }