Skip to content

Commit bde7c25

Browse files
committed
DragManager: Allow running without a picker
The block picker may not be necessary when using blocks in game. For example, the scene could be about reaching a goal with the existing blocks in the canvas.
1 parent 99e3d11 commit bde7c25

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

addons/block_code/drag_manager/drag_manager.gd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ var drag: Drag = null
2424

2525

2626
func _ready():
27-
_picker = get_node(picker_path)
27+
if picker_path:
28+
_picker = get_node(picker_path)
2829
_block_canvas = get_node(block_canvas_path)
2930

3031

@@ -55,7 +56,8 @@ func drag_block(block: Block, copied_from: Block = null, offset: Vector2 = Vecto
5556

5657
drag = Drag.new(block, block_scope, offset, _block_canvas)
5758
drag.set_snap_points(get_tree().get_nodes_in_group("snap_point"))
58-
drag.add_delete_area(_picker.get_global_rect())
59+
if _picker:
60+
drag.add_delete_area(_picker.get_global_rect())
5961
if block is ParameterBlock and block.spawned_by:
6062
drag.add_delete_area(block.spawned_by.get_global_rect())
6163
add_child(drag)

0 commit comments

Comments
 (0)