- 最后登录
- 2021-7-6
- 注册时间
- 2012-12-27
- 阅读权限
- 90
- 积分
- 76145
- 纳金币
- 53488
- 精华
- 316
|
对一些不规则添加多边形碰撞器后会自动生成一堆点,还要清掉很麻烦,就写了这么个东西,直接在Inspector上右键clear即可- using UnityEngine;
- using System.Collections;
- using UnityEditor;
- public class PolyEditor{
- [MenuItem("CONTEXT/PolygonCollider2D/Clear")]
- private static void Clear(MenuCommand mc)
- {
- PolygonCollider2D pc2D = mc.context as PolygonCollider2D;
- pc2D.pathCount = 1;
- pc2D.SetPath (0,new Vector2[]{Vector2.zero,Vector2.right,Vector2.up});
- }
- }
复制代码 |
|