Summary
Registers the `callback` with the `name` but throws an
System.ArgumentException
if something was already registered with the same `name`.
It will be invoked using Animancer.AnimancerEvent.GetCurrentParameter``1
to get its parameter.
- Assembly
- Animancer
.dll - Namespace
- Animancer
- Containing Type
- NamedEventDictionary
Syntax
public Action AddNew<T>(StringReference name, Action<T> callback)
Remarks
This matches the standard
System.Collections.Generic.Dictionary`2.Add(`0,`1)
behaviour,
unlike Animancer.NamedEventDictionary.AddTo``1(Animancer.StringReference,System.Action{``0})
.
If T is string
,
consider using Animancer.NamedEventDictionary.AddTo(Animancer.StringReference,System.Action{System.String})
instead of this overload.
If you want to later remove the `callback`,
you need to store and remove the returned System.Action
.
Type Parameters
Name | Description |
---|---|
T |
Parameters
Name | Type | Description |
---|---|---|
name | StringReference | |
callback | Action |
Return Value
Type | Description |
---|---|
Action |