Class SignalReceiver
Listens for emitted signals and reacts depending on its defined reactions.
Implements
Inherited Members
Namespace: UnityEngine.Timeline
Assembly: Unity.Timeline.dll
Syntax
public class SignalReceiver : MonoBehaviour, INotificationReceiver
Methods
AddEmptyReaction(UnityEvent)
Appends a null SignalAsset with a reaction specified by the UnityEvent.
Declaration
public int AddEmptyReaction(UnityEvent reaction)
Parameters
Type | Name | Description |
---|---|---|
UnityEvent | reaction | The new reaction to be appended. |
Returns
Type | Description |
---|---|
int | The index of the appended reaction. |
Remarks
Multiple null assets are valid.
See Also
AddReaction(SignalAsset, UnityEvent)
Defines a new reaction for a SignalAsset.
Declaration
public void AddReaction(SignalAsset asset, UnityEvent reaction)
Parameters
Type | Name | Description |
---|---|---|
SignalAsset | asset | The SignalAsset for which the reaction is being defined. |
UnityEvent | reaction | The UnityEvent that describes the reaction. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the asset is null. |
ArgumentException | Thrown when the SignalAsset is already registered with this receiver. |
See Also
ChangeReactionAtIndex(int, UnityEvent)
Replaces the reaction at a specific index with a new UnityEvent.
Declaration
public void ChangeReactionAtIndex(int idx, UnityEvent reaction)
Parameters
Type | Name | Description |
---|---|---|
int | idx | The index of the reaction to be replaced. |
UnityEvent | reaction | The replacement reaction. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the replacement reaction is null. |
See Also
ChangeSignalAtIndex(int, SignalAsset)
Replaces the SignalAsset associated with a reaction at a specific index.
Declaration
public void ChangeSignalAtIndex(int idx, SignalAsset newKey)
Parameters
Type | Name | Description |
---|---|---|
int | idx | The index of the reaction. |
SignalAsset | newKey | The replacement SignalAsset. |
Remarks
The new SignalAsset can be null.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the replacement SignalAsset is already registered to this SignalReceiver. |
See Also
Count()
Returns the count of registered SignalAssets.
Declaration
public int Count()
Returns
Type | Description |
---|---|
int |
See Also
GetReaction(SignalAsset)
Gets the first UnityEvent associated with a SignalAsset.
Declaration
public UnityEvent GetReaction(SignalAsset key)
Parameters
Type | Name | Description |
---|---|---|
SignalAsset | key | A SignalAsset defining the signal. |
Returns
Type | Description |
---|---|
UnityEvent | Returns the reaction associated with a SignalAsset. Returns null if the signal asset does not exist. |
See Also
GetReactionAtIndex(int)
Gets the reaction at a specific index.
Declaration
public UnityEvent GetReactionAtIndex(int idx)
Parameters
Type | Name | Description |
---|---|---|
int | idx | The index of the reaction. |
Returns
Type | Description |
---|---|
UnityEvent | Returns a reaction. |
See Also
GetRegisteredSignals()
Gets a list of all registered SignalAssets.
Declaration
public IEnumerable<SignalAsset> GetRegisteredSignals()
Returns
Type | Description |
---|---|
IEnumerable<SignalAsset> | Returns a list of SignalAssets. |
See Also
GetSignalAssetAtIndex(int)
Gets the SignalAsset at a specific index
Declaration
public SignalAsset GetSignalAssetAtIndex(int idx)
Parameters
Type | Name | Description |
---|---|---|
int | idx | The index of the SignalAsset. |
Returns
Type | Description |
---|---|
SignalAsset | Returns a SignalAsset. |
See Also
OnNotify(Playable, INotification, object)
Called when a notification is sent.
Declaration
public void OnNotify(Playable origin, INotification notification, object context)
Parameters
Type | Name | Description |
---|---|---|
Playable | origin | The playable that sent the notification. |
INotification | notification | The received notification. Only notifications of type SignalEmitter will be processed. |
object | context | User defined data that depends on the type of notification. Uses this to pass necessary information that can change with each invocation. |
See Also
Remove(SignalAsset)
Removes the first occurrence of a SignalAsset.
Declaration
public void Remove(SignalAsset asset)
Parameters
Type | Name | Description |
---|---|---|
SignalAsset | asset | The SignalAsset to be removed. |
See Also
RemoveAtIndex(int)
Removes the SignalAsset and reaction at a specific index.
Declaration
public void RemoveAtIndex(int idx)
Parameters
Type | Name | Description |
---|---|---|
int | idx | The index of the SignalAsset to be removed. |