using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GetSphereSize : MonoBehaviour
{
public GameObject sp;
// Start is called before the first frame update
void Start()
{
Vector3 length = sp.GetComponent<Renderer>().bounds.size;
print(length);
}
// Update is called once per frame
void Update()
{
}
}
GetComponent<MeshFilter>().sharedMesh.bounds.size获得的是未经缩放的大小。
GetComponent<Renderer>().bounds.size获得是是经过缩放后的大小。