Skip to content

Commit

Permalink
fix: only add debug cam if debug build
Browse files Browse the repository at this point in the history
  • Loading branch information
yusdacra committed Dec 5, 2024
1 parent 7c3d08f commit b66cf2e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
5 changes: 0 additions & 5 deletions addons/debug_camera/scripts/DebugCamAutoload.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ extends Node
var debug_cam_2d = preload("res://addons/debug_camera/scripts/DebugCamera2D.gd")
var debug_cam_3d = preload("res://addons/debug_camera/scripts/DebugCamera3D.gd")


func _ready() -> void:
add_debug_cam(get_tree().current_scene)


## call this function after you scene is ready to add the debug camera to it
func add_debug_cam(scene: Node) -> void:
var cam_2d := debug_cam_2d.new()
Expand Down
11 changes: 6 additions & 5 deletions scenes/entrypoint/entrypoint.gd
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ func _ready() -> void:
CONNECT_ONE_SHOT
)
)
# hook the debug camera in for all scenes we load
Scenes.scene_changed.connect(
func(scene: Node, _params: Dictionary) -> void:
DebugCam.add_debug_cam(scene)
)
# hook the debug camera in for all scenes we load (if debug)
if OS.is_debug_build():
Scenes.scene_changed.connect(
func(scene: Node, _params: Dictionary) -> void:
DebugCam.add_debug_cam(scene)
)
# load our scene
Scenes.change_scene_to(initial_scene)

0 comments on commit b66cf2e

Please sign in to comment.