Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

BindUFunction with Variable Capture in C++

Is this possible? If yes, how is it done?


Product Version: UE 4.18 Preview
more ▼

asked Oct 16 '17 at 03:18 AM in C++ Programming

avatar image

447 35 36 67

avatar image calembendell Oct 19 '17 at 02:11 PM

is bumping possible?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You could bind a lambda and then capture what you want. Even if it needs to be an UFunction just make a wrapped with the lambda and call your inner UFunction with the captured members.

more ▼

answered Oct 16 '17 at 06:18 AM

avatar image

6.4k 127 98 606

avatar image calembendell Oct 16 '17 at 02:33 PM

Hey Moss, would it be possible for you to post a code snippet showing how to do that? I'm having a hard time figuring out how to get a UFunction pointer from a lambda. Thanks!

avatar image Moss Oct 24 '17 at 10:34 AM

You could do something like:

 void UMyClass::FunctionWithVar(const FString& MyVar, TFunction<void(const FString&)> InFunction)
     MyLambdaHandle = OnMyDelegate.BindStatic([MyVar](TFunction<void(const FString&)> callback) {
     }, InFunction);
     // TODO: You have to track MyLambdaHandle to be able to unregister it when needed

Note: It's all hand written and may not compile

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question