using Sirenix.OdinInspector; using System.Collections; using System.Collections.Generic; using UnityEngine; public class ResetCenterPoint : MonoBehaviour { [Button("生成中心点")] private void ResetPoint() { GameObject obj = new GameObject(); obj.name = gameObject.name+"---中心点"; obj.transform.position = transform.GetComponent().bounds.center; obj.transform.SetParent(transform.parent); transform.SetParent(obj.transform); } }