Hi,
I’m looking to make something identical to the onclick event dropdown with a list of all the functions attached to a certain gameObject. I’m having trouble actually writing the GUI script for this and displaying a dropdown of all the functions. This is my script.
class test {
[HideInInspector]
public List<MethodInfo> methods = new List<MethodInfo>();
private BindingFlags flag = BindingFlags.Public;
private void OnEnable()
{
var mb = effected.GetComponent<MonoBehaviour>().GetType().GetMethods(flag);
methods.AddRange(mb);
}
}
GUI script:
[CustomEditor(typeof(PressableButton))]
public class MethodListDrawer : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
PressableButton scr = (PressableButton)target;
GUIContent label = new GUIContent("MyArray");
EditorGUILayout.Popup(scr.selected, scr.methods.ToArray());
}
Thanks.