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:
Create 2 custom resources, 'res_a ’ and ‘res_b’
Export an array of type ‘res_b’ in ‘res_a’
Instantiate a .tres file in the project files for ‘res_a’
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?
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.