I am trying to use the GenericMenu but there is no documentation for it in C# and I can’t figure out how to use it, all I get is this error:
Error:
A method or delegate DrawEditor.Callback(UnityEngine.Object)' parameters do not match delegate
UnityEditor.GenericMenu.MenuFunction2(object)’ parameters
GenericMenu Documentation: Unity - Scripting API: GenericMenu
The function that you are passing to the GenericMenu items, must match the callback definition for the AddItem method:
Javascript:
function Callback (obj:Object) {
Debug.Log ("Selected: " + obj);
}
function Callback () {
Debug.Log ("No object passed");
}
C#
void Callback (Object obj) {
Debug.Log ("Selected: " + obj);
}
void Callback () {
Debug.Log ("No object passed");
}