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

TargetParameterCountException on instance event calling static methods #7

Open
marc-antoine-girard opened this issue Oct 5, 2022 · 0 comments

Comments

@marc-antoine-girard
Copy link

Description:

Unity throws TargetParameterCountException

  • when an instanced ExtEvent calls a static method with one parameter (int in my case).
  • It does not throw when calling a method without parameter.
  • It does not throw when the ExtEvent is set to static and is calling a static method with a parameter.

Expected:

Calling a static method with one parameter using an instance event should behave the same way as calling a static method with no parameter using an instance event.

How to reproduce:

Given the code below:

public class Test : MonoBehaviour
{
    public ExtEvent voidEvent;

    private void OnEnable()
    {
        voidEvent.Invoke();
    }

    public static void StaticCallNoArg()
    {
        Debug.Log("StaticCallNoArg");
    }
    public static void StaticCallOneArg(int a)
    {
        Debug.Log($"StaticCallOneArg {a}");
    }
    public void InstanceCallNoArg()
    {
        Debug.Log("InstanceCallNoArg");
    }

    public void InstanceCallOneArg(int a)
    {
        Debug.Log($"InstanceCallOneArg {a}");
    }
}

image
(red one throws)

Output:
image

Additional information:

  • Unity 2021.3.9
  • ExtEvents 1.7.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant