GodotVR / godot_openvr

GDNative based Open VR module
MIT License
227 stars 35 forks source link

Crash if OpenVRConfig isn't instantiated in Godot first #109

Open BastiaanOlij opened 3 years ago

BastiaanOlij commented 3 years ago

This is not by design :)

Found out on stream yesterday that if OpenVRConfig isn't initialized within Godot first that the engine crashes, presumably because certain default values aren't set up as the underlying singleton should be created even if the GDNative object isn't.

Workaround for now is to make sure you execute:

var openvr_config = preload("res://addons/godot-openvr/OpenVRConfig.gdns");
if openvr_config:
    print("Setup configuration")
    openvr_config = openvr_config.new()

before arvr_interface.initialize() is run.

beniwtv commented 3 years ago

Yes, actually now that OpenVRConfig does more, we'd want to instantiate it anyway all the time.

BastiaanOlij commented 3 years ago

Indeed, which is why I never ran into this before but I guess we can't guarantee its instantiated.

Haven't found the cause yet though