public static void ShowWindow() { SceneView.onSceneGUIDelegate -= OnSceneGUI; SceneView.onSceneGUIDelegate += OnSceneGUI; //BSPTree tree = new BSPTree(Selection.activeGameObject, Selection.activeGameObject.GetComponent<MeshFilter>().sharedMesh); btree = ScriptableObject.CreateInstance(typeof(BSPTree)) as BSPTree; btree.Init(Selection.activeGameObject, Selection.activeGameObject.GetComponent<MeshFilter>().sharedMesh); hasfinished = true; }