Join Session 을 하던 중 참여할 세션은 발견했지만 해당 세션에 참여가 되질 않는 문제가 발생했다.
에러 관련 메세지를 얻기위한 로직을 작성하였고
아래와 같은 메세지를 얻었다.
Unknown error...허무하군...
관련 정보를 찾던 중 아래 글을 찾았다.
정리하자면, 세션을 생성할때 설정해준 bUseLobbiesIfAvailable = true;
과 bUsesPresence = true;
에 대한 설정이 동일하지 않아서 세션에 접속할 수 없으니 해당 설정을 세션 참가할때도 해줘야한다는 말이다...
이해안가는 부분은 참여하고자 하는 세션에 대한 설정은 발견한 세션에 대한 정보를 가져와 JoinSession() 함수에 넣어주는데 왜 설정이 동일하지 않다는건지... 모르겠다...
아래와 같이 직접 해당 설정을 해주는 코드를 넣어줬다.
/* Issue */
Result.Session.SessionSettings.bUseLobbiesIfAvailable = true;
Result.Session.SessionSettings.bUsesPresence = true;
/* Issue End */
const ULocalPlayer* LocalPlayer = GetWorld()->GetFirstLocalPlayerFromController();
OnlineSessionInterface->JoinSession(*LocalPlayer->GetPreferredUniqueNetId(), NAME_GameSession, Result);
해당 코드를 넣고 패키징 후, 다시 시도해보면 정상적으로 세션에 참여가 되는걸 확인할 수 있었다.
또한 해당 글의 작성자가 참고한 UE의 Dev Forum 의 글을 확인해보면 추가적으로 참여할 세션을 찾을때 설정해주는 부분에서 QuerySettings 의 Key 값으로 사용하는 SEARCH_PRESENCE
가 이후 버전부턴 더 이상 동작하지 않을거라는 경고문을 띄운다는 내용이 있다.
Refer : UE Dev Forum_Join Session
실제로 내 프로젝트에서도 해당 에러가 발생하고 있었다.
0>MenuSystemCharacter.cpp(173): Warning C4996 : 'SEARCH_PRESENCE': SEARCH_PRESENCE ("PRESENCESEARCH") is deprecated and will soon stop being a valid UE-defined key. Please consult upgrade notes for more details Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.
이와 관련된 설정은 아래의 코드다.
SessionSearch = MakeShareable(new FOnlineSessionSearch());
SessionSearch->MaxSearchResults = 10000;
SessionSearch->bIsLanQuery = false;
SessionSearch->QuerySettings.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
EARCH_PRESENCE
대신 사용할 값을 찾아서 넣어줘야 하는데 마땅한 값을 아직 찾지 못했다... 관련내용은 5.5의 릴리스 노트 어디에도 언급되어 있지 않은것 같고 포럼에서도 찾을 수 없었다 ㅠ
You must add:
SessionSettings->bUseLobbiesIfAvailable = true;
SessionSettings->bUsesPresence = true;
and change to:
SessionSearch->QuerySettings.Set(SEARCH_LOBBIES, true, EOnlineComparisonOp::Equals);
See: https://github.com/EpicGames/UnrealEngine/commit/50d88b68429872ee689edcd0b2d623c60153be91