Skip to content

Calling AnimationPlayer.RootNode from C# errors in exported version #82993

Closed
@poohcom1

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:

  1. Create a C# script that references an AnimationPlayer.
  2. Call AnimationPlayer.RootNode.
  3. Create a debug or release export.
  4. Run the export with console.
  5. The scene will show a "GDScript" label, but not the "CSharp" label because the CSharp script errored.
  6. Check the console output for the error message.

With the MRP:

  1. Create an export.
  2. Run the export with console.
  3. Same steps as above.

Minimal reproduction project

dotnet-getrootnode-mrp.zip

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions