-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add possibility to create autoload from script (without using the project settings) #5143
Comments
I would use keyword |
global
keyword to create autoload from script (without using the project settings)
See also #4993.
extends Node
autoload Global Also while this has the benefit of translating naturally from one project to another without further setup, I'm curious how often one would have to add a singleton for it to become that tedious. |
Actually, how would this interact with scripts that extend |
I personally see no reason for this to make sense currently, so it would throw an error. |
I don't see how this can be useful without being able to concisely name and order your autoloads. Plus, to enable/disable these kinds of autoloads you'd have to modify the script file directly and add/remove the keyword. The most likely scenario here I can see is, the user losing track of how and where autoloads are coming from and how they interact. Re naming: Autoloads are not Singletons, though they share qualities. Resources are Singletons. |
Yeah, seems like a not good idea… |
Describe the project you are working on
Describe the problem or limitation you are having in your project
This is not a limitation - just an impovement.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
The idea is to allow user creating autoload from script rather than from project setting (for the sake of comfortability and uniformity).
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
The following code would automatically make autoload
Global
for the script:class_name
is mandatory for such scripts to allow use it in other scripts (but may be omitted if it's self-contained).If this enhancement will not be used often, can it be worked around with a few lines of script?
No
Is there a reason why this should be core and not an add-on in the asset library?
It's a core GDScript change
The text was updated successfully, but these errors were encountered: