BindUObject passing parameter

Hi folks, I’m trying to pass a value to the function used in the following binding;


Request->OnProcessRequestComplete().BindUObject(this, &AAPI_call::OnResponseReceived);

at the moment that function only recives the following but I also want to pass an int value to the function to execute on. How would I do that?


void ATest::OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)

1 Like

You would need to edit OnProcessRequestComplete to be a delegate that takes 4 parameters instead of 3.

Do you have access to the source where OnProcessRequestComplete is defined and broadcasted?

This would mean editing the engin source code, it would work but not make it very compatible.

Would I be able to check if the bindUobject function has finished before running the next function. The issue I have is it is executing other functions below before completing ie.

Beginplay()
function with bindUobject function.
Function 2, starting before the bound function has finished.

1 Like

Sorry for necroposting, were you able to solve this? I have the exact same question!

You can use Bind/CreateWeakLambda to bind to a lambda without running into issues if/when your object gets destroyed :

Request->OnProcessRequestComplete().BindWeakLambda(this, [this, SomeValue](FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
{
    OnResponseReceived2(Request, Response, bWasSuccessful, SomeValue);
});
1 Like

Thank you so much! I would have never figured it out by myself! I’ll flag your post to be marked as answer since the post is very old and I doubt that the OP would do it!