Hello. I am using following code to create UnityEvents dynamicaly by enum collection.
/// <summary>
/// All no parameters events
/// </summary>
public enum NoParamEvents
{
AttackUp,
AttackDn,
AttackLt,
AttackRt,
}
/// <summary>
/// Dictionary for events with no params related to NoParamEvents enum
/// </summary>
public Dictionary<NoParamEvents, UnityEvent> _events = new Dictionary<NoParamEvents, UnityEvent>();
/// <summary>
/// Adds events into dictionary. Key is enum variables
/// </summary>
private void FillUpDictionaryNoPatamEvents()
{
foreach (var e in (NoParamEvents.GetValues(typeof(NoParamEvents))))
{
_events.Add((NoParamEvents)e, new UnityEvent());
}
}
now I want ot use event instead of UnityEvent
[/code]
public delegate void theDelegate();
public Dictionary<NoParamEvents, theDelegate> _es = new Dictionary<NoParamEvents, theDelegate>();
private void FillUpDictionaryNoPatamEvents()
{
foreach (var e in (NoParamEvents.GetValues(typeof(NoParamEvents))))
{
_es.Add((NoParamEvents)e, new theDelegate);
}
}
I stack on error for new theDelegate.
_es.Add((NoParamEvents)e,new theDelegate);
How to handle the error?
