Hi! I’ve been trying to make online sessions work for a while now and I’m stuck with some things.
After a lot of research I found some kind of “guides” about how to look for a session and I was trying to use this code in the OnlineSessionInterfaceCrossgen.cpp file (as Find Sessions is not implemented in this script) and everything seems ok in most things, but when I try to build the project I get this error message:
"assigning to ‘FDelegateHandle(FOnlineSessionCrossgen::*)(bool)’ from incompatible type ‘FDelegateHandle’ "
My handles are:
FDelegateHandle OnFindSessionsCompleteDelegateHandle;
// The delegate executed by the online subsystem
FOnFindSessionsCompleteDelegate FindSessionsCompleteDelegate;
and the FindSessions code is:
bool FOnlineSessionCrossgen::FindSessions(const FUniqueNetId& SearchingPlayerId, const TSharedRef<FOnlineSessionSearch>& SearchSettings)
{
UE_LOG_ONLINE(Log, TEXT("Implementing FindSessions for PS5"));
FOnlineAsyncTaskGetSessionByIdComplete TaskCompletionDelegate;
SessionSearchSettings = SearchSettings;
IOnlineSubsystem* OnlineSub = IOnlineSubsystem::Get();
if (OnlineSub) {
IOnlineSessionPtr Sessions = OnlineSub->GetSessionInterface();
if (Sessions.IsValid() && SearchingPlayerId.IsValid()) {
FDelegateHandle(FOnlineSessionCrossgen::* OnFindSessionsCompleteDelegateHandle)(bool);
//FindSessionsCompleteDelegate = (FOnFindSessionsCompleteDelegate::CreateUObject(this, &FOnlineSessionCrossgen::OnFindSessionsComplete));
OnFindSessionsCompleteDelegateHandle = Sessions->AddOnFindSessionsCompleteDelegate_Handle(FindSessionsCompleteDelegate);
Sessions->FindSessions(SearchingPlayerId, SessionSearchSettings);
}
}
else {
FOnlineSessionCrossgen::OnFindSessionsComplete(false);
}
return true;
}
I’ve already created the handle in the constructor (that’s why it’s commented in the function), this error message comes from the line
OnFindSessionsCompleteDelegateHandle = Sessions → AddOnFindSessionsCompleteDelegate_Handle…
Is there something I’m doing wrong or missing in this?
Thanks a lot to anyone who can offer some light to this