using Godot; namespace Cirno.Scripts; public static class Tools { public static T CreateChild(this Node2D node, PackedScene prefab) where T : Node2D { if (prefab == null) return null; var newInstance = prefab.Instantiate(); node.Owner.CallDeferred("add_child", newInstance); newInstance.Transform = node.GlobalTransform; newInstance.Position = node.Position; return newInstance; } }