Hello dear community,
for 2 days now, I am having trouble to bind a function to delegates from the OnlineSession interface.
For example, there is this nice delegate called FOnSessionInviteReceivedDelegate, which I want to bind a function to. So, I did the following:
First, I created a delegate variable within my .h file:
const FOnSessionInviteReceivedDelegate onSessionInviteRecievedDelegate;
Second, I declared a function, which is supposed to bind to the delegate:
void OnInviteRecieved(const FUniqueNetId & bWasSuccessful, const FUniqueNetId & ControllerId, const FString & UserId, const FOnlineSessionSearchResult & InviteResult);
Later, in my .cpp file, I am using these lines:
`
IOnlineSubsystem* OnlineSubsystem = IOnlineSubsystem::Get(“Steam”);
IOnlineSessionPtr Sessions = OnlineSubsystem->GetSessionInterface();
Sessions->AddOnSessionInviteReceivedDelegate_Handle(onSessionInviteRecievedDelegate);
onSessionInviteRecievedDelegate.BindSP(this, &UTheCompanyGameInstance::OnInviteRecieved);
`
That’s when I keep getting the error-message that the function’s signature does not comply with the signature of the delegate. When I dig into the OnlineSessionInterface.h file to lookup the delegate, I find the following:
`
DECLARE_MULTICAST_DELEGATE_FourParams(FOnSessionInviteReceived, const FUniqueNetId& /UserId/, const FUniqueNetId& /FromId/, const FString& /AppId/, const FOnlineSessionSearchResult& /InviteResult/);
typedef FOnSessionInviteReceived::FDelegate FOnSessionInviteReceivedDelegate;`
Which indicates me that my function’s signature is correct, isn’t it?
Can somebody tell me what on earth I am doing wrong?
Any help would be much appreciated :-).
Best wishes,