- Home /
Custom Event: why is my method not listed in the inspector's dropdown?
Hi, I'm trying to define a UnityEvent with two parameters (string and int), and then subscribe a method to that event using the inspector.
Here is my event declaration:
[System.Serializable]
public class CustomEvent : UnityEvent <string , int > {}
And the public event
public CustomEvent myCustomEvent;
And here is the method I want to subscribe do that event.
public void GuideMe (string message, int value) {
print (message);
print (value);
}
If I subscribe the method in code it works just fine
bReference.myCustomEvent.AddListener (GuideMe);
But if I try to do this via the inspector, my method is not listed in the dropdown
What am I doing wrong?
Answer by jeango · Oct 10, 2017 at 12:32 PM
Well, silly me, it was listed in the "Dynamic string, int" portion of the dropdown...
I kept looking in the "Static Parameters" list for some dumb reason. Oh well, hope this serves someone else as silly as me.
Your answer
![](https://koobas.hobune.stream/wayback/20220612140703im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to change array orders in the inspector 1 Answer
No prompt to name animation 0 Answers
Script to respond to event chosen from Inspector 0 Answers
How to destroy particles from a given point in unity (In particle system inspector) 1 Answer
Unity Weird Inspector Layout Behavior: Can't Scroll To the Bottom of Component Fields 8 Answers