paulloz / godot-ink

Ink integration for Godot Engine.
MIT License
588 stars 41 forks source link

4.2.2 GDScript Interop issue #90

Open Bard09 opened 5 months ago

Bard09 commented 5 months ago

Describe the bug After upgrading from 4.2 to 4.2.2 I am seeing several errors in my GDScript code that reference GodotInk C# methods via Interop. Here are two examples of the error:

res://Main.gd:303 - Parse Error: Too few arguments for "EvaluateFunction()" call. Expected at least 2 but received 1. res://Main.gd:377 - Parse Error: Too few arguments for "BindExternalFunction()" call. Expected at least 3 but received 2.

GDScript references to C# methods appear to be binding now to the non-Interop C# methods in InkStory in GDScript rather than the Interop ones.

To Reproduce Call C# methods successfully in GDScript via Interop in 4.2; upgrade to Godot 4.2.2, and there should be errors displayed on load of the 4.2 project.

As an example of the EvaluateFunction error above, here's what reproduces it in 4.2.2 with an Ink Story that has a function called "now":

var story: InkStory = preload("res://Story.ink")
var date: String = story.EvaluateFunction("now")

Environment

Additional context This is the first time I've upgraded Godot, so if there's an implicit post-upgrade step I've missed, let me know :)

Could this 4.2.2 C# change be indicative that perhaps we may not need the Interop methods any more? (maybe I'm talking crazy!)

paulloz commented 5 months ago

Thank you for the report.

After a bunch of testing, this looks like a regression in Godot itself, and was reported as such^1.
In the meantime, you should be able to call the long versions of those methods. E.g., calling story.EvaluateFunction("now") is the same thing as calling story.EvaluateFunction("now", []). The second arguments being the array of arguments you'd pass to the ink function (nothing).

Sorry for the inconvenience.

Bard09 commented 1 month ago

It looks like https://github.com/godotengine/godot/pull/90968 was fixed in the recent 4.3 release. I haven't had a chance to upgrade yet but looking forward to see if this resolves this issue!