diff --git a/demo/main.gd b/demo/main.gd index b75dd6ae..09352d72 100644 --- a/demo/main.gd +++ b/demo/main.gd @@ -1,7 +1,6 @@ extends Node3D var xr_interface : XRInterface = null -var scene_capture: OpenXRFbSceneCaptureExtensionWrapper = null # Called when the node enters the scene tree for the first time. func _ready(): @@ -10,8 +9,9 @@ func _ready(): var vp: Viewport = get_viewport() vp.use_xr = true - scene_capture = Engine.get_singleton("OpenXRFbSceneCaptureExtensionWrapper") - scene_capture.connect("scene_capture_completed", _on_scene_capture_completed) + var scene_capture := Engine.get_singleton("OpenXRFbSceneCaptureExtensionWrapper") + if scene_capture: + scene_capture.connect("scene_capture_completed", _on_scene_capture_completed) func _on_scene_capture_completed(): @@ -19,6 +19,7 @@ func _on_scene_capture_completed(): func _on_left_hand_button_pressed(name): + var scene_capture := Engine.get_singleton("OpenXRFbSceneCaptureExtensionWrapper") if name == "menu_button" and scene_capture: print("Triggering scene capture") scene_capture.request_scene_capture()