MeshTool.SpawnCollider(mode);using UnityEngine;
public class MeshTool
{
public static Bounds SpawnCollider(Transform target)
{
Vector3 pMax = Vector3.zero;
Vector3 pMin = Vector3.zero;
Vector3 center = Vector3.zero;
Vector3 oldPos = target.transform.position;
Quaternion oldQua = target.transform.rotation;
Vector3 oldScale = target.transform.localScale;
target.transform.position = Vector3.zero;
target.transform.rotation = Quaternion.identity;
target.transform.localScale = Vector3.one;
Bounds bounds = CalcBounds(target, ref pMax, ref pMin, ref center);
BoxCollider collider = target.GetComponent<BoxCollider>();
if (collider