Steam friend list has not presence state in build game

Hello,

In the editor in standalone mode, I only see my friends who are not offline and I can see their status.
(It’s OK)

But when on my game build, I see all my friends and no status…
(All state return true)
Why?

I use Advanced sessions.

2 Likes

I am noticing this same issue, using 5.4.2 source build. Have you figured this out? Happens for me both with advanced sessions and a custom implementation so I don’t think it is an issue with Advanced Sessions

2 Likes

This is happening to me as well, using launcher version 5.4.2. Has anyone found a workaround?

From Unreal 5.4 changelog I noticed this:

  • Fixed an issue with the Friends interface in the Steam OSS not properly polling and retaining presence data.
1 Like

I inspected the GetPresence() method in the engine’s OnlineFriendsInterfaceSteam.cpp and made a workaround for this issue (using AdvancedSessions plugin).

In AdvancedFriendsLibrary.h, add this to the UAdvancedFriendsLibrary class:

static const FOnlineUserPresence GetPresence(const FUniqueNetId& Id);

In AdvancedFriendsLibrary.cpp:

const FOnlineUserPresence EmptyPresence;

const FOnlineUserPresence UAdvancedFriendsLibrary::GetPresence(const FUniqueNetId& Id)
{
  // TODO: insert return statement here
  if (IOnlineSubsystem* SteamOSS = IOnlineSubsystem::Get(STEAM_SUBSYSTEM))
  {
    // Get the steam presence interface
    if (auto OnlinePresence = SteamOSS->GetPresenceInterface().Get())
    {
      TSharedPtr<FOnlineUserPresence> Presence;
      EOnlineCachedResult::Type Result = OnlinePresence->GetCachedPresence(Id, Presence);

      if(Presence.IsValid())
      {
        auto P = *Presence.Get();
        return P;
      }
    }
  }

  return EmptyPresence;
}

Then modify the GetStoredFriendsList method’s for loop with this:

    for (int32 i = 0; i < FriendList.Num(); i++)
    {
      FBPFriendInfo BPF;
      const FOnlineUserPresence pres = GetPresence(FriendList[i]->GetUserId().Get());

      BPF.OnlineState = ((EBPOnlinePresenceState)((int32)pres.Status.State));
      BPF.DisplayName = FriendList[i]->GetDisplayName();
      BPF.RealName = FriendList[i]->GetRealName();
      BPF.UniqueNetId.SetUniqueNetId(FriendList[i]->GetUserId());
      BPF.bIsPlayingSameGame = pres.bIsPlayingThisGame;

      BPF.PresenceInfo.bIsOnline = pres.bIsOnline;
      BPF.PresenceInfo.bHasVoiceSupport = pres.bHasVoiceSupport;
      BPF.PresenceInfo.bIsPlaying = pres.bIsPlaying;
      BPF.PresenceInfo.PresenceState = ((EBPOnlinePresenceState)((int32)pres.Status.State));
      // #TODO: Check back in on this in shipping, epic is missing the UTF8_TO_TCHAR call on converting this and its making an invalid string
      //BPF.PresenceInfo.StatusString = pres.Status.StatusStr;
      BPF.PresenceInfo.bIsJoinable = pres.bIsJoinable;
      BPF.PresenceInfo.bIsPlayingThisGame = pres.bIsPlayingThisGame;

      FriendsList.Add(BPF);
    }

Now in blueprints I’m getting the friend list array like this:

1 Like

This saved me a lot of headache. Thank you for posting this.

Unfortunately this fix did not work for me, the code still works fine in standalone PIE but when packaged the friends list does not populate at all. No idea why this is happening

so i found the class that causes this issue and a solution that doesnt require a work arround but does require you to use a source build.

the issue are commits made to the OnlineFriendsInterfaceSteam class i personally didnt bother going thought the code to and git to see the exact issue (you can if you want ) but just copy pasted the classes .h and .ccp from 5.3 or 5.2 rebuild the engine and everything seems to work fine again. hope this helps the next person with this issue

appearently you need 5.2 not 5.3 the commits are allready added there

Hello, according to your words you just need to take .h .ccp online subsystem steam c 5.3 and throw them for example in 5.5.1 version and everything will work only here is the problem I did so, but the result is the same, if you have succeeded can show or tell how you achieved that the online state will output something

(post deleted by author)

try 5.2 i think i also needed to go back further and use 5.2 instead let me know if that one works.