-
-
Notifications
You must be signed in to change notification settings - Fork 21.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
Fix Script Editor saves C# files as embedded scripts. #88692
Conversation
If other instances of the script exist, taking over path will make them unlinked from the original resource. It might cause attached scripts to stop updating (relevant for tool scripts). |
63df3eb
to
802604b
Compare
Just to clarify, the only scenario in which C# creates a different instance rather than using the previous one is when the C# script has not yet been compiled. Once it is compiled, there will be only one instance. I'm not sure about other scripting languages, though. |
So I just realized
This points to a bug in C# loader, because CACHE_MODE_IGNORE is not supposed to do that. |
This comment was marked as resolved.
This comment was marked as resolved.
802604b
to
6728d42
Compare
Thanks for pointing this out, the new PR should correctly and safely fix the bug and any future bugs related to multiple instances of C# script. |
While this works, it's not exactly how it should be implemented. |
6728d42
to
973a4b1
Compare
Thanks. I was completely ignored the |
fixes: godotengine#88543 fixes: godotengine#88160 Because of the limitations of compiled programming languages like C#, when a newly created *.cs file hasn't been compiled, we don't have any information about its `Path` or `Type` in the `assemply`. This means we end up creating an invalid instance of this file whenever there's a request. Consequently, multiple instances of the script can exist. When a new instance takes over the path, it clears the `path_cache` of the previous instance, leading to undefined behavior.
973a4b1
to
c5e6a58
Compare
Thanks! |
fixes: #88543
fixes: #88160
Because of the limitations of compiled programming languages like C#, when a newly created *.cs file hasn't been compiled, we don't have any information about its
Path
orType
in theassembly
. This means we end up creating an invalid instance of this file whenever there's a request. Consequently, multiple instances of the script can exist. When a new instance takes over the path, it clears thepath_cache
of the previous instance, leading to undefined behavior.