纳金网
标题:
清空多边形碰撞器points
[打印本页]
作者:
烟雨
时间:
2016-7-30 21:45
标题:
清空多边形碰撞器points
对一些不规则添加多边形碰撞器后会自动生成一堆点,还要清掉很麻烦,就写了这么个东西,直接在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});
}
}
复制代码
欢迎光临 纳金网 (http://old.narkii.com/club/)
Powered by Discuz! X2.5