Delegate Example
A simple way of delegate utilization on C# / Unity
//C# Delegate:
public delegate [return] DelegateName([type parameter]...);
//Sample:
public delegate void CalbackHandler(int pIndex);
//So you can use it as a parameter to other method:
public void PassDelegateByParameter( CallbackHandler pHandler )
{
pHandler( 1 ); // it will invoke pHandler delegate.
}
Written by Bruno Mikoski
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Unity
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#