- Home /
custom event delegate - convertible error
Hi all,
I am using the following:
public event EventHandler<HandCollection> HandsDetected;
with the HandCollection class being:
public class HandCollection
{
public ulong TrackingId { get; set; }
public Hand HandLeft { get; set; }
public Hand HandRight { get; set; }
}
but in the console i get the following error and i have no idea why or how to solve it:
"The Type HandCollection must be convertible to 'Systm.EventArgs' in order to use it as parameter 'TEventArgs' in the generic type or method 'System.EventHandler "
Have you meet "The type or namespace name `Vector' could not be found. Are you missing a using directive or an assembly reference?"
GamesDeveloper12
$$anonymous$$ay I know your Email ? I face the same question as you . Could you guide me ?
Answer by GamesDeveloper12 · Apr 21, 2016 at 04:53 PM
seem to have fixed it, i added:
: System.EventArgs
based on what i read here:
http://answers.unity3d.com/questions/574535/does-unity-support-eventargs.html
Answer by Owa-Intelligence · Apr 21, 2016 at 05:16 PM
public delegate HandCollection HandCollectionHandler();
public static event HandCollectionHandler HandDetected;
void Start()
{
HandDetected+=DetectedHand;
}
HandleCollection DetectedHand()
{
return null;
}