-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
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
Script UID improvements #87418
Comments
Preloading with only a UID is less readable and inconsistent with other resources (it is assumed that UIDs can be safely removed/changed). I would expect an optional const Type = preload("res://script.gd", "uid://acdc") The same for extends "res://script.gd", "uid://acdc" Also note that you can use relative paths with extends "./script.gd"
const Type = preload("./other_script.gd") For |
This would also allow us to have a warning if the plain path is out of date, possibly with an option to update it in the editor |
No, the whole purpose of UID is that it's not supposed to change, unlike paths. The engine ensures that. Other resources already support load and preload, it only doesn't work for scripts. The readability can be always improved by adding a tooltip when hovering UID or even displaying it in a special way.
That's not any different from what we have now. When you change path, any script referencing it will break. Issuing a warning would require scanning every script on every path change and updating is useless unless it happens automatically. We could implement that even without UIDs. |
I meant with both uid and path, that specific suggestion |
This is only possible for the built-in editor. For external editors, GitHub, etc. this is less convenient (requires plugins or is not possible). When you see
Sometimes Godot changes UIDs for some reason, even if I didn't recreate the resource, but only edited/renamed/moved that resource or its dependencies. I think that in the current implementation this is also possible for GDScript, since the UID line is not only inserted when creating the So I wouldn't be sure that UID persistence is guaranteed. Also, as far as I understand, UID was not intended to be a replacement for file paths, only a secondary addressing system. All other resources store both file path and UID. The UID may be missing, but the path must be there. This is what I meant by inconsistency.
The difference is that if you encounter an incorrect file path (for example, if you got someone else's project), you can try to look for the components of the path in the file system, most often the file can be quickly found. If you encounter an incorrect UID that has no references left along with the file path, then it could be almost any script/resource (if you are not familiar with the project). |
Tested versions
4.3
System information
Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 (NVIDIA; 30.0.15.1403) - Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 Threads)
Issue description
GDScript has a basic UID support now, but it has some missing features:
extends "uid://acdc"
)const Type = preload("uid://acdc")
)The first two result in an error currently, the last one does not exist (though you can copy UID using FileSystem context menu).
Steps to reproduce
Try using any of the above.
Minimal reproduction project (MRP)
N/A
The text was updated successfully, but these errors were encountered: