godot: Rename a C# Script filename (NOT GdScript) referenced in a Scene, leaves the Scene with the old C# Script filename raising the error "can_instantiate: ..."
Godot version
4.2 RC 1 for .NET
System information
Windows 10
Issue description
Rename a C# Script filename (NOT a GdScript) referenced in a Scene, leaves the Scene with the old C# Script filename raising the error "can_instantiate: Cannot instance script because the associated class could not be found...".
IMPORTANT: This bug exists ONLY with C# code and NOT with GdScript.
Steps to reproduce
Simply create a new scene and attach a new C# script (NOT a GdScript), save all, after rename the attached C# script filename, save all and you will see that the Scene will continue to search for the old script filename. To fix you have to remove the script reference from the scene and add the new one.
Minimal reproduction project
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 1
- Comments: 15 (9 by maintainers)
You’ve skipped the part of the error pointing at why it happens. Full error after renaming
Main.cstoNewName.csin the MRP:Renaming the script doesn’t change the contents of such script, meaning:
Mainclass is found inMain.cs, all good.NewNameclass is not found inNewName.cs, hence the error.Renaming
Mainclass withinNewName.cstoNewNamemakes the error go away:Not sure if that’s a bug.
https://github.com/godotengine/godot-proposals/issues/4603
Probably fixed by #85037
Edit: Unless you didn’t change the class name in the file like noted above