System.Collections.Generic.Dictionary.Remove(UnityEventBase)

Here are the examples of the csharp api System.Collections.Generic.Dictionary.Remove(UnityEventBase) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 Source : UXEventDelegate.cs
with MIT License
from unfernojp

public static void RemoveListener( object target, string name, UnityAction callback ) {
			if ( !_initialized ) { throw new Exception( string.Format( "{0} is not initialized.", "UXEventDelegate" ) ); }
			if ( target == null ) { throw new Exception( string.Format( "Argument {1} of method {0} can not be omitted.", "RemoveListener()", "target" ) ); }

			UnityEventBase unityEventBase = _getUnityEventBase( target, name );

			if ( unityEventBase == null ) { throw new Exception( string.Format( "Does not exist {0} field of the corresponding UnityEvent type.", name ) ); }

			if ( _eventCallbacks.ContainsKey( unityEventBase ) ) {
				List<UnityAction> callbacks = _eventCallbacks[unityEventBase];

				if ( callbacks.Contains( callback ) ) {
					callbacks.Remove( callback );

					if ( callbacks.Count == 0 ) {
						_eventCallbacks.Remove( unityEventBase );
					}
				}
			}

			UnityEvent unityEvent = unityEventBase as UnityEvent;

			if ( unityEvent != null ) {
				unityEvent.RemoveListener( callback );
			}
		}