Unity showing events in the Inspecter panel

 

 

public class MyPlanet : MonoBehaviour
{
        [Serializable]
        public class ZoomLevelChangedEvent : UnityEvent<int> { }
        public ZoomLevelChangedEvent zoomLevelChangedEvent;
}

If you want to display in custom Editor

override public void OnInspectorGUI()
{
    serializedObject.Update();

    EditorGUILayout.BeginVertical();
    SerializedProperty sprop = serializedObject.FindProperty("zoomLevelChangedEvent");
    EditorGUILayout.PropertyField(sprop, new GUIContent("zoomLevelChangedEvent Object"));
    EditorGUILayout.EndVertical();

	serializedObject.ApplyModifiedProperties();
}

Guess you like

Origin blog.csdn.net/zouxin_88/article/details/121949884