UnityEngine.Events.UnityEvent.AddListener C# (CSharp) Method

AddListener() public method

Add a non persistent listener to the UnityEvent.

public AddListener ( UnityAction call ) : void
call UnityAction Callback function.
return void
        public void AddListener(UnityAction call)
        {
            base.AddCall(GetDelegate(call));
        }

Usage Example

コード例 #1
0
    public static void AddStringEditorListener(this UnityEngine.Events.UnityEvent unityEvent, UnityAction <string> call, string argument)
    {
#if UNITY_EDITOR
        if (Application.isPlaying)
        {
            UnityEditor.Events.UnityEventTools.AddStringPersistentListener(unityEvent, call, argument);
        }
        else
        {
            unityEvent.AddListener(() => call.Invoke(argument));
        }
#else
        unityEvent.AddListener(() => call.Invoke(argument));
#endif
    }
All Usage Examples Of UnityEngine.Events.UnityEvent::AddListener