diff --git a/addons/bson/bson.gd b/addons/bson/bson.gd index 47ba328..72e1a05 100644 --- a/addons/bson/bson.gd +++ b/addons/bson/bson.gd @@ -2,7 +2,10 @@ # This file is the BSON serializer for the Godot Engine, # published under the MIT license. https://opensource.org/license/MIT -class_name BSON +extends Node +# Unfortunately, this has to be a node in order to be a singleton. +# I'd rather BSON wasn't in the scenetree, but it seems like that's +# the only way to do this. Hopefully this will change in the future. static func to_bson(data: Dictionary) -> PackedByteArray: diff --git a/project.godot b/project.godot index 1ffbe97..4ee103b 100644 --- a/project.godot +++ b/project.godot @@ -15,6 +15,10 @@ run/main_scene="res://BSON Examples/dunk.tscn" config/features=PackedStringArray("4.3", "Forward Plus") config/icon="res://icon.svg" +[autoload] + +BSON="*res://addons/bson/bson.gd" + [editor_plugins] enabled=PackedStringArray("res://addons/bson/plugin.cfg")