You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A C# tool script cannot have a custom resource property set. It will result in the following error:
/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/ExceptionUtils.cs:112 - System.InvalidCastException: Unable to cast object of type 'Godot.Resource' to type 'Prism.ProceduralAnimation.JointConstraintSet'.
at Prism.ProceduralAnimation.InverseKinematics.RestoreGodotObjectData(GodotSerializationInfo info) in C:\Users\Dylan\Projects\studio-mantissa\Godot.SourceGenerators\Godot.SourceGenerators.ScriptSerializationGenerator\Prism.ProceduralAnimation.InverseKinematics_ScriptSerialization.generated.cs:line 32
at Prism.ProceduralAnimation.IKOnNode3D.RestoreGodotObjectData(GodotSerializationInfo info) in C:\Users\Dylan\Projects\studio-mantissa\Godot.SourceGenerators\Godot.SourceGenerators.ScriptSerializationGenerator\Prism.ProceduralAnimation.IKOnNode3D_ScriptSerialization.generated.cs:line 22
at Godot.Bridge.CSharpInstanceBridge.DeserializeState(IntPtr godotObjectGCHandle, godot_dictionary* propertiesState, godot_dictionary* signalEventsState) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs:line 255
Steps to reproduce
Assuming MRP:
Select any node that has a tool script with a custom resource property
Attempt to create a new resource to fill that property, or load a resource from the filesystem
Property will remain null, and resource will not be created, and the above error will be thrown.
Scripts not marked as [Tool] can't be instantiated in the editor, instead we create a placeholder to hold the necessary data (that's how you can edit it in the inspector). So you need to add the [Tool] attribute to the C# classes that you want to use in the editor (this includes resources that you want to access from other tool scripts because they run in the editor).
Tested versions
I suspect but have not confirmed that this bug has always been present in the C# build.
System information
Godot v4.2.stable.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3080 (NVIDIA; 31.0.15.3734) - AMD Ryzen 9 5900X 12-Core Processor (24 Threads)
Issue description
A C# tool script cannot have a custom resource property set. It will result in the following error:
Steps to reproduce
Assuming MRP:
Minimal reproduction project (MRP)
CSharp Tool Script Resource Error MRP.zip
The text was updated successfully, but these errors were encountered: