String path to script doesn't update on Resources with exported typed Arrays

Godot Version

Godot 4.2


I vaguely remember this issue being talked about awhile ago, but I cannot find it the bug report on github, so I don’t know if it is getting fixed soon. Or how to work around it until then. Please help?

The issue is that the string path inside a .tres file that references a script resource for an exported custom typed array, does not update when a change is made to the path.

Steps to reproduce:

  1. Create 2 custom resources, 'res_a ’ and ‘res_b’
  2. Export an array of type ‘res_b’ in ‘res_a’
  3. Instantiate a .tres file in the project files for ‘res_a’
  4. The file works fine until you change the path to the script for 'res_b". To do this I just change the name of a folder within the path.

If you open the .tres file for the instantiated ‘res_a’ it still contains the original path to the script, at the moment you instantiated ‘res_a’.
I remember people talking about how the engine is saving the path to exported array types in a more static way, therefore it doesn’t update after the resource is created.

Any news on this? Is everyone just not typing your Arrays with custom types?

Thanks for reading

So I played around with it a little more today, and confirmed the issue more specifically.

In the tres file for the Resource, scripts should be saved as external Resources, with an assigned id. The string path updates correctly in these cases.

However, a typed array by default, will be identified by its string path upon creation of the Resource object, and will not be treated as an external Resource, and will not be updated if the path is changed.

BUT, the script of the array type WILL be treated as an external Resource IF you create a new object of that type, directly inside the exported array as a sub resource. Which means you cannot create a standalone “res_b” and drag/drop it into the exported array, for whatever reason this does NOT update as an external Resource, and maintains its static string path; which breaks all instantiations of that resource in the file system, if the script path is changed (ie renaming a folder or file)

I think when this got fixed, it was just “half-fixed”. It only updates as an external Resource the moment you create a sub-resource directly inside the exported array in the editor. It should save as an external resource by default.

Found the issue on GitHub! Looks like it was fixed in Godot 4.3-dev6
So whenever 4.3 is released, this shouldn’t be an issue anymore.