Fix for barrels not exploding properly in tilemaps

This commit is contained in:
MaddoScientisto 2024-08-17 19:11:49 +02:00
commit 0eb6a9140f
5 changed files with 44 additions and 37 deletions

View file

@ -8,7 +8,9 @@ public static class Tools
{
if (prefab == null) return null;
var newInstance = prefab.Instantiate<T>();
node.Owner.CallDeferred("add_child", newInstance);
node.GetParent().CallDeferred("add_child", newInstance);
// Need to use parent instead of owner because tilemap scenes have no owner
//node.Owner.CallDeferred("add_child", newInstance);
newInstance.Transform = node.GlobalTransform;
newInstance.Position = node.Position;