YarnSpinnerTool / YarnSpinner-Unity

The official Unity integration for Yarn Spinner, the friendly dialogue tool.
MIT License
491 stars 85 forks source link

v3: SourceCodeGenerator throwing compile errors #281

Open dario-zubovic opened 3 months ago

dario-zubovic commented 3 months ago

What is the current behavior?

YarnSpinner.Unity.SourceCodeGenerator\ActionRegistrationSourceGenerator\YarnActionRegistration-PROJECTNAME.Generated.cs(23,67): error CS1503: Argument 2: cannot convert from 'method group' to 'Delegate'

YarnSpinner.Unity.SourceCodeGenerator\ActionRegistrationSourceGenerator\YarnActionRegistration-PROJECTNAME.Generated.cs(24,73): error CS1503: Argument 2: cannot convert from 'method group' to 'Delegate'

YarnSpinner.Unity.SourceCodeGenerator\ActionRegistrationSourceGenerator\YarnActionRegistration-PROJECTNAME.Generated.cs(55,60): error CS1503: Argument 2: cannot convert from 'method group' to 'Delegate'

Please provide the steps to reproduce, and if possible a minimal demo of the problem: Just import development/v3 branch in Unity 2022.3.22f1.

What is the expected behavior? Generated code should compile without any errors.

Please tell us about your environment:

dario-zubovic commented 3 months ago

Managed to narrow down which command is producing invalid generated code:

[YarnCommand("test")]
public static IEnumerator Test()
{
    yield return null;
}

However, these signatures produce valid code:

So I would deduce that in order to generate broken code, method tagged with YarnCommandAttribute must:

Note that methods with same signature didn't cause any issues with Yarn 2.4.