You can actually use lambdas already with UE4 delegates, as long as you don’t capture variables with your lambda. Here is an example from some Slate UI.
SNew(SImage)
.Image( FEditorStyle::GetBrush("EditorLiveStreaming.BroadcastButton") )
.ColorAndOpacity_Static( ]
{
FSlateColor Color = FLinearColor( 1.0f, 1.0f, 1.0f, FMath::MakePulsatingValue( FSlateApplication::Get().GetCurrentTime(), 2.0f ) );
return Color;
} )
For timelines, you would use syntax like:
MyDelegate = FOnTimelineEvent::CreateStatic( ] { DoSomething(); } );
In 4.6 we will have support for stateful lambdas as well, by using the new “FMyDelegate::CreateLambda()” functions that we’ve added. Hope that helps!
–Mike