using UnityEngine;
public class ObjectDimensions : MonoBehaviour
{
void Start()
{
// 获取物体的边界盒子
Bounds bounds = GetComponent<Renderer>().bounds;
// 获取长度、宽度和高度
float length = bounds.size.x; // 长度
float width = bounds.size.y; // 宽度
float height = bounds.size.z; // 高度
// 打印长度、宽度和高度
Debug.Log("Length: " + length);
Debug.Log("Width: " + width);
Debug.Log("Height: " + height);
}
}