纳金网

标题: 清空多边形碰撞器points [打印本页]

作者: 烟雨    时间: 2016-7-30 21:45
标题: 清空多边形碰撞器points
对一些不规则添加多边形碰撞器后会自动生成一堆点,还要清掉很麻烦,就写了这么个东西,直接在Inspector上右键clear即可
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEditor;

  4. public class PolyEditor{
  5.     [MenuItem("CONTEXT/PolygonCollider2D/Clear")]
  6.     private static void Clear(MenuCommand mc)
  7.     {
  8.         PolygonCollider2D pc2D = mc.context as PolygonCollider2D;
  9.         pc2D.pathCount = 1;
  10.         pc2D.SetPath (0,new Vector2[]{Vector2.zero,Vector2.right,Vector2.up});

  11.     }
  12. }
复制代码





欢迎光临 纳金网 (http://old.narkii.com/club/) Powered by Discuz! X2.5