- Home /
Does MonoDevelop Autocomplete Event Listeners?
So, today I stumbled across a functionality in MonoDevelop that seems extremely useful, but I'm not sure if it's actually doing what I think it's doing.
I use event handlers a lot. I almost always format the class dispatching the event like this
public class EventDispatcher : MonoBehaviour {
public delegate void MouseOverNotifier(GameObject e);
public event MouseOverNotifier MouseOver;
void OnMouseOver () {
if (MouseOver != null)
MouseOver (this.gameObject);
}
}
and format the listener like this
public class EventListener : MonoBehaviour{
private GameObject s;
void Start(){
s.GetComponent<EventDispatcher>().MouseOver += Listener;
{
void Listener(GameObject g){
//g is being hovered, do something...
}
}
But today I noticed that when I get to actually attaching the listener, if I bring up the autocomplete window after the += I get something that says appears to automatically set up a class with the event dispatcher name, and the specific event, preceded by the word "Handle." It then automatically creates a function below with the same name. So for the above example it would have automatically generated something called "HandleSMouseOver" after the += and then create a function by the same name, ready to put code into, with the correct data type in the parentheses and everything.
Sorry, sort of a long description, but is MonoDevelop doing what I think it's doing and just doing a bunch of extra formatting work for me? I couldn't find any references to this behavior anywhere.
Your answer
![](https://koobas.hobune.stream/wayback/20220613110554im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Mono Develop lost autocompletion and refactoring 14 Answers
Monodevelop autocomplete help! 2 Answers
Monodevelop autocompletion doesn't work 1 Answer
Autocomplete, Monodevelop, and String/string 0 Answers
New Scripts have no autocomplete.. 1 Answer