Godot version: 4.7.1
OS: windows 11
Describe the bug
When using Phantom Camera alongside the Beehave plugin, Godot throws the error: Failed to retrieve non-existent singleton 'PhantomCameraManager' and other scripts are reporting null reference.
The PhantomCameraManager Node is a tool script that is referenced in the editor scene tree,and the scene camera nodes will locate the manager node from _enter_tree.
It could be related to the latest Godot 4.7.1 autoload guard fix.
The Beehave is working fine but is somehow causing the Godot Editor to kill the PhantomCameraManager (the registerd node is lost)
This is the manager node and it would register itself when entering tree.
@tool
extends Node
func _enter_tree() -> void:
if not Engine.has_singleton(_CONSTANTS.PCAM_MANAGER_NODE_NAME):
Engine.register_singleton(_CONSTANTS.PCAM_MANAGER_NODE_NAME, self)
Engine.physics_jitter_fix = 0
func _exit_tree() -> void:
if Engine.has_singleton(_CONSTANTS.PCAM_MANAGER_NODE_NAME):
Engine.unregister_singleton(_CONSTANTS.PCAM_MANAGER_NODE_NAME)
To Reproduce
Steps to reproduce the behavior:
- Install both plugins and enable phantom camera first, then enable beehave
- restart the editor
Investigation
I ran several tests and tried to find the cause. It's possibly a conflict in the Godot plugin lifecycle initialization between the two plugins.
-
Blang Plugin Test: Created an empty plugin to test Godot's register_singleton / add_autoload_singleton API works ok.
-
Single Plugin Test: Phantom Camera alone does not produce the error. The bug only manifests when the Beehave plugin is also enabled.
-
Possible Lifecycle Conflict: I found that Beehave is registering its singletons inside the _init() method:
func _init():
name = "BeehavePlugin"
add_autoload_singleton("BeehaveGlobalMetrics", "metrics/beehave_global_metrics.gd")
add_autoload_singleton("BeehaveGlobalDebugger", "debug/global_debugger.gd")
# Add project settings...
-
**Workaround Fix:**I modified Beehave's code by moving the singleton registration to _enable_plugin(). This does fix the issue on phantom camera plugin.
func _enable_plugin() -> void:
add_autoload_singleton(METRIC_NAME, "metrics/beehave_global_metrics.gd")
add_autoload_singleton(DEBUGGER_NAME, "debug/global_debugger.gd")
-
I also commented out the utils/utils.gd method that searches for the plugin, replacing it with EditorInterface singleton
var border_size := Vector2(4, 4) * EditorInterface.get_editor_scale()
var editor_main_screen = EditorInterface.get_editor_main_screen()
Additional context
Im not sure if i should report this issue here, since it feels like a godot problem, but just in case others also encountered it and needed the workaround
Godot version: 4.7.1
OS: windows 11
Describe the bug
When using Phantom Camera alongside the
Beehaveplugin, Godot throws the error:Failed to retrieve non-existent singleton 'PhantomCameraManager'and other scripts are reporting null reference.The PhantomCameraManager Node is a tool script that is referenced in the editor scene tree,and the scene camera nodes will locate the manager node from
_enter_tree.It could be related to the latest Godot 4.7.1 autoload guard fix.
The
Beehaveis working fine but is somehow causing the Godot Editor to kill thePhantomCameraManager(the registerd node is lost)This is the manager node and it would register itself when entering tree.
To Reproduce
Steps to reproduce the behavior:
Investigation
I ran several tests and tried to find the cause. It's possibly a conflict in the Godot plugin lifecycle initialization between the two plugins.
Blang Plugin Test: Created an empty plugin to test Godot's
register_singleton/add_autoload_singletonAPI works ok.Single Plugin Test: Phantom Camera alone does not produce the error. The bug only manifests when the Beehave plugin is also enabled.
Possible Lifecycle Conflict: I found that Beehave is registering its singletons inside the
_init()method:**Workaround Fix:**I modified Beehave's code by moving the singleton registration to
_enable_plugin(). This does fix the issue on phantom camera plugin.I also commented out the utils/utils.gd method that searches for the plugin, replacing it with EditorInterface singleton
Additional context
Im not sure if i should report this issue here, since it feels like a godot problem, but just in case others also encountered it and needed the workaround