List <int> selectedVertexIndex; //选择的顶点的下标 void OnEnable() { instance = this; SceneView.duringSceneGui -= this.OnSceneGUI; SceneView.duringSceneGui += this.OnSceneGUI; selectObj = Selection.activeGameObject; selectMesh = Selection.activeGameObject.GetComponent <MeshFilter>().mesh; selectMeshCollider = Selection.activeGameObject.GetComponent <MeshCollider>(); selectObjVectors = selectMesh.vertices; //获取游戏物体上的顶点在世界空间的坐标 selectMeshVectorWPs = LocalToWorld(selectMesh.vertices, selectObj.transform); }
void OnDisable() { instance = null; SceneView.duringSceneGui -= this.OnSceneGUI; }