Closed
Description
Godot version
4.2-dev6
System information
Windows 11
Issue description
Using the RootNode
getter on AnimationPlayer
from C# causes the following error in both debug and release exports.
ERROR: System.TypeInitializationException: The type initializer for 'Godot.AnimationMixer' threw an exception.
---> Godot.GodotObject+NativeMethodBindNotFoundException: Unable to find the native method bind. (Method 'AnimationMix)
at Godot.GodotObject.ClassDB_get_method_with_compatibility(StringName type, StringName method, UInt64 hash)
at Godot.AnimationMixer..cctor()
--- End of inner exception stack trace ---
at Godot.AnimationMixer.GetRootNode()
at Godot.AnimationMixer.get_RootNode()
at TestCSharp._Ready() in C:\Users\Pooh\Code\games\test-4.2dev6-animplayer\TestCSharp.cs:line 11
at Godot.Node.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret)
at Godot.CanvasItem.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret)
at Godot.Node2D.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret)
at TestCSharp.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in C:8
at Godot.Bridge.CSharpInstanceBridge.Call(IntPtr godotObjectGCHandle, godot_string_name* method, godot_variant** arg)
at: void Godot.NativeInterop.ExceptionUtils.LogException(System.Exception) (:0)
The code runs fine in the editor and the same issue does not happen with GDScript.
Steps to reproduce
From scratch:
- Create a C# script that references an
AnimationPlayer
. - Call
AnimationPlayer.RootNode
. - Create a debug or release export.
- Run the export with console.
- The scene will show a "GDScript" label, but not the "CSharp" label because the CSharp script errored.
- Check the console output for the error message.
With the MRP:
- Create an export.
- Run the export with console.
- Same steps as above.
Activity