How to prevent GameCenter on Unity from attempting to authenticate every time app enters foreground?

101 Views Asked by At

I have basic GameCenter authentication code:

Social.localUser.Authenticate((success, err) =>
{
  Debug.Log($"SocialPlatformPlugin returned success ${success} and error {err}");
});

This works fine, I call in the Start method of one of my manager classes. However every time I background and foreground the app, I see the Debug.Log fire again, with the stack trace:

MyScript.<>c__DisplatClass2_0:<MyMethod>b_00(Boolean)
UnityEngine.SocialPlatforms.GameCenter.GameCenterSocialPlatform:AuthenticateCallbackWrapper(Int32, String)

Which means GameCenter is trying to reauthenticate (and possibly bring up a popup). Is there a way to prevent this?

0

There are 0 best solutions below