Browse Source

prevent remove of 2d context if not our own

Nicolas Cannasse 5 years ago
parent
commit
bbc8869e6b
1 changed files with 4 additions and 2 deletions
  1. 4 2
      hrt/prefab/l3d/Instance.hx

+ 4 - 2
hrt/prefab/l3d/Instance.hx

@@ -116,8 +116,10 @@ class Instance extends Object3D {
 	override function removeInstance(ctx:Context):Bool {
 		if(!super.removeInstance(ctx))
 			return false;
-		if(ctx.local2d != null)
-			ctx.local2d.remove();
+		if(ctx.local2d != null ) {
+			var pctx = ctx.shared.getContexts(parent)[0];
+			if( pctx != null && pctx.local2d != ctx.local2d ) ctx.local2d.remove();
+		}
 		return true;
 	}