Lambda support for Unreal Engine dynamic delegates
This is experimental feature. Now only parametless lambdas are supported
To see more details, explore tests and implementation :)
Update: this repo isn't abandoned, parametrized delegates support reqiures more time for invastigation
Usage is very simple:
- Copy files from repo to your project
- Include DynamicLambda.h
- Bind lambdas to your delegates
DECLARE_DYNAMIC_DELEGATE(FSimpleTestDelegate);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FSimpleTestMulticastDelegate);
UCLASS()
class UDynamicLambdaTest : public UObject
{
GENERATED_BODY()
public:
UPROPERTY()
FSimpleTestDelegate SimpleTestDelegate;
UPROPERTY()
FSimpleTestMulticastDelegate SimpleTestMulticastDelegate;
};
...
// Short subscription form is preffered
Test->SimpleTestDelegate += [&] { DoSomeStuff(); };
// To bind 'weak' lambda use 'tuple' syntax
Test->SimpleTestDelegate += (MyObjectPtr, [&]{ DoSomeStuff(); });
- Support all dynamic delegates with parameters
- Write some docs
- Dedicate this code to plugin
- Implement unsubscription
- TBD