godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.59k stars 21.27k forks source link

Engine.get_singleton_list() does not include autoload scripts defined in the project settings. #93263

Open KnightNine opened 5 months ago

KnightNine commented 5 months ago

Tested versions

v4.2.2.stable.custom_build [0cfe9491e]

System information

Windows 10

Issue description

Autoload Scripts are also called Singletons in the docs but I do not see them in Engine.get_singleton_list() thus I cannot get them with Engine.get_singleton() when I probably should be able to.

I only see the inbuilt singletons when I print the singleton list:

["Performance", "TextServerManager", "PhysicsServer2DManager", "PhysicsServer3DManager", "NavigationMeshGenerator", "ProjectSettings", "IP", "Geometry2D", "Geometry3D", "ResourceLoader", "ResourceSaver", "OS", "Engine", "ClassDB", "Marshalls", "TranslationServer", "Input", "InputMap", "EngineDebugger", "Time", "GDExtensionManager", "ResourceUID", "WorkerThreadPool", "ThemeDB", "JavaClassWrapper", "JavaScriptBridge", "DisplayServer", "RenderingServer", "AudioServer", "PhysicsServer2D", "PhysicsServer3D", "NavigationServer2D", "NavigationServer3D", "XRServer", "CameraServer"]

Steps to reproduce

Create some Autoload Scripts in the project settings and see if they show up in Engine.get_singleton_list().

Minimal reproduction project (MRP)

N/A

AThousandShips commented 5 months ago

As mentioned on the issue this is documented in 4.3:

Note: Global singletons are not the same as autoloaded nodes, which are configurable in the project settings.

This should be clarified in 4.2 as well, and should also probably be clarified in the scripting documentation