Closed MrEliptik closed 2 years ago
@MrEliptik What exactly is the problem with the autoload appearing at the bottom of the list?
In my case I wanted the Steam singleton to be loaded first because I had other singletons using it to do different things. As I said in my first message, it's not a deal breaker, I can do something else. It's just that I didn't understand why it would always go back to being at the bottom of the list even though I moved it.
@MrEliptik So you have your own autoload, that during its _ready
function, calls the Steam Autload before its called its _ready
function?
@samsface Yes exactly and I wasn't aware the Steam plugin was going to change the order of the autoload by adding the Steam.gd dynamically.
@MrEliptik Ok gotcha. Is there a way to check if a script is already autoloaded? Then we could not add the autoload automatically if it's already there.
By looking at some GitHub issues, some people recommend opening the project.godot as a ConfigFile
and looking at the autoload section, but I found a very simple way using ProjectSettings
.
You can check if the autoload is present by doing: ProjectSettings.get("autoload/Steam")
this returns the script path if present, otherwise null
Neat, added a check using this and seems to work :pray:
Because the
steam.gd
singleton is added by theEditorPlugin
dynamically, it's always put at the end of the autoload list. It seems we can't decide the order when adding a singleton by code unfortunately, unless I missed something?This is not a huge problem, it's possible to go around this limitation but I just wanted to talk about it in case someone else is having the same problem. It's frustrating to set the order in the settings and then getting it overridden.
If there's no other solution, maybe we could add a warning somewhere in the readme or in the SteamAPI project settings panel?