Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Functions using Delegates for handlers detect argument counts incorrectly #39

Open
fmoo opened this issue Jul 12, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@fmoo
Copy link

fmoo commented Jul 12, 2023

What is the current behavior?

When defining a custom function in e.g., Unity Yarnspinner as follows:

runner.AddFunction<int, int, int>("rand_irange", delegate (int min, int max) {
    return UnityEngine.Random.Range(min, max + 1);
 });

The VSCode Extension reports the error:

Function rand_irange expects 0 parameters, but received 2
rand_irange

Please provide the steps to reproduce, and if possible a minimal demo of the problem:

Register a function similar to as follows:

runner.AddFunction<int, int, int>("rand_irange", delegate (int min, int max) {
    return UnityEngine.Random.Range(min, max + 1);
 });

In a yarn script, invoke as follows:

<<declare $temple_slot = 0>>
<<set $temple_slot = rand_irange(1,10)>>

What is the expected behavior?

The script works correctly at runtime, so I expect no errors to be detected by vscode

Please tell us about your environment:

  • Yarn Spinner Version: 2.1
  • Extension Version: v2.2.119
  • Unity Version: 2019.4.36f1

Other information

@fmoo fmoo added the bug Something isn't working label Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant