Skip to content

Umkerius/DynamicLambda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DynamicLambda

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

How to use

Usage is very simple:

  1. Copy files from repo to your project
  2. Include DynamicLambda.h
  3. Bind lambdas to your delegates

Example

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(); });

Next steps

  1. Support all dynamic delegates with parameters
  2. Write some docs
  3. Dedicate this code to plugin
  4. Implement unsubscription
  5. TBD

About

Lambda support for Unreal Engine dynamic delegates

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages