Browse Source

Merge pull request #356 from Fenrisul/master

One more adjustment to SkeletonRenderer.
Fenrisul 10 years ago
parent
commit
a903db829b
1 changed files with 12 additions and 7 deletions
  1. 12 7
      spine-unity/Assets/spine-unity/SkeletonRenderer.cs

+ 12 - 7
spine-unity/Assets/spine-unity/SkeletonRenderer.cs

@@ -139,17 +139,22 @@ public class SkeletonRenderer : MonoBehaviour {
 	}
 
 	public virtual void OnDestroy () {
-		if (Application.isPlaying) {
-			if (mesh1 != null) {
+		if (mesh1 != null) {
+			if (Application.isPlaying)
 				Destroy(mesh1);
-				mesh1 = null;
-			}
+			else
+				DestroyImmediate(mesh1);
+		}
 
-			if (mesh2 != null) {
+		if (mesh2 != null) {
+			if (Application.isPlaying)
 				Destroy(mesh2);
-				mesh2 = null;
-			}
+			else
+				DestroyImmediate(mesh2);
 		}
+
+		mesh1 = null;
+		mesh2 = null;
 	}
 
 	private Mesh newMesh () {