Proposal for a (better?) UID support in Godot 4.4

Hello everyone, this is my first post and I am new to this forum, so please forgive me if this topic has already been discussed (but I didn’t find anything searching the posts).

I am looking at the new UID solution that should be shipped with Godot 4.4 and I am really worried it will produce a bigger impact than expected.
I read the article about why UIDs are so important and I completely agree with the article, but among the various approaches that devs have considered it seems that the solution I am going to introduce was missing.

Why the external file is problematic:

  • file system pollution
  • the user must remember to move two files to be consistent

And this will kill code readability:

# These references point to the same Script resource.
# `other_script.gd` contains a `static func greet()` that prints some text.
var other_script = preload("res://other_script.gd")

# TIP: You can copy any resource's UID from the FileSystem dock's context menu.
# THIS WILL SLOW DOWN DEVELOPMENT IN SO MANY WAYS...
var other_script_uid = preload("uid://fkjlqx8er2sg")

Furthermore, if in the future we want to use AI agents to create files for us, there could be a problem in automatically adding files into the file system.

My proposal is simple, yet effective: embed the UID inside the resource file name. Using 36 decimal notation, we can have rappresent 1.679.615 unique IDs with just 4 characters in the filename.

For eg. the other_script.gd could be called other_script.x653.gd, so the user could continue to write:

var other_script = preload("res://other_script.x653.gd")

when the resource name is parsed, internally Godot could just care for the x653 part and load by UID and not by filename.

Since with the external file the user should remember to move two files each time, he/she can also be instructed to just don’t touch the last part of a filename.

This is it, simple and effective.

I don’t know if I am posting in the right place, if not, please tell me and I’ll move the discussion in a more appropriate location.

Thanks for reading

4 Likes

I don’t know if I am posting in the right place, if not, please tell me and I’ll move the discussion in a more appropriate location.

If you want your proposal to be looked at by the Godot team you need to raise it in the godot-proposals Github repo.

There are some UID proposals open already that are kinda of related to yours:

2 Likes