PlayEveryWare / eos_plugin_for_unity

Repository for PlayEveryWare's EOS Plugin for Unity, bringing the functionality of Epic Online Services to the Unity Game Engine.
https://eospluginforunity.playeveryware.com
288 stars 56 forks source link

Samples, steam account linking, loginCallbackInfo.LocalUserId is null #576

Closed hesham-akmal closed 5 months ago

hesham-akmal commented 7 months ago

I have encountered a null exception and I've fixed it in my project, so I'm sharing the fix.

The error log: image

In the sample "Standard Pack : EOS Plugin for Unity Samples", a script named UILoginMenu.cs (I used it as reference for steam login, steam account linking with EOS on the first session).

The method named StartConnectLoginWithLoginCallbackInfo(LoginCallbackInfo loginCallbackInfo), the paramater LoginCallbackInfo is used to get loginCallbackInfo.LocalUserId. But in the case of "loginCallbackInfo.ResultCode == Epic.OnlineServices.Result.InvalidUser" (User is linking steam with an active Epic account), the loginCallbackInfo.LocalUserId was null in my case, so I needed to use linkAccountCallbackInfo.LocalUserId instead (callback of AuthLinkExternalAccountWithContinuanceToken).

I changed StartConnectLoginWithLoginCallbackInfo parameter of LoginCallbackInfo to EpicAccountId, and to send the LocalUserId accordingly.

Like so:

image

paulhazen commented 6 months ago

Hi @hesham-akmal, apologies for the delayed response. Can you tell me which version of the plugin you are using? Based on your posted code I'm wondering whether you might be using an older version of the plugin.

In the absence of that possibility, did you perhaps refactor UILoginMenu.cs?

hesham-akmal commented 6 months ago

@paulhazen no worries! Version is 3.0.3 Sample imported from the unity package manager image

Sorry for the confusion, the above code images is after my refactoring and fixes.

Original UILoginMenu.cs, this is where the issue resides, the loginCallbackInfo.LocalUserId (used in method StartConnectLoginWithLoginCallbackInfo) was null/empty as loginCallbackInfo.ResultCode is Epic.OnlineServices.Result.InvalidUser (line 1330) image

However for some reason I think this was working for me like 6 months ago, not really sure.

andrew-hirata-playeveryware commented 6 months ago

Ah I think I see the error with this: The code is using what appears to be the wrong callback for information. It should be using the other callback information. I can probably throw together a little fix for this.

paulhazen commented 5 months ago

@hesham-akmal I'm closing this issue as it has been fixed in the development branch via pull #626. If you are still having difficulty with it please feel free to re-open the issue with additional context about the problem.

paulhazen commented 5 months ago

Re-opening because I realized that the PR (while open) has not been merged.