VirtualFramework/Assets/Projects/Scripts/AutoAddCollision.cs

23 lines
434 B
C#
Raw Normal View History

2025-03-11 14:10:38 +08:00
using UnityEngine;
using System.Collections;
public class AutoAddCollision: MonoBehaviour
{
// Use this for initialization
//void Start()
//{
// ModelAddMeshCollider();
//}
[ContextMenu("<22><><EFBFBD><EFBFBD>")]
void ModelAddMeshCollider()
{
foreach (var render in transform.GetComponentsInChildren<MeshRenderer>())
{
render.gameObject.AddComponent<MeshCollider>();
}
}
}