Download

Important: Google Play Games/Online Subsystem login flow breaking changes in 4.9

Hey everyone,

Since the full release notes aren’t available as of this post, and 4.9 Preview 1 is available now, I wanted to let everyone know about a breaking change in 4.9 regarding login to Google Play Games services. For those of you following the GitHub master branch, the change is in this commit.

Most of these changes also apply to Game Center on iOS, so for any iOS specific issues, please refer to this thread.

Up through 4.8, the Google Play online subsystem (if enabled) would automatically start the login process, and potentially show the Google login UI, during engine startup - the game had no way of controlling when the UI came up, and in addition, it was causing timing issues that we had to work around in the engine.

To address these problems, in 4.9 the Google Play sign-in process and login UI is no longer triggered automatically at startup. We have implemented the IOnlineExternalUI::ShowLoginUI function for Google Play and added a new Blueprint node, “Show External Login UI”, which wraps this function. The existing “Connect to Service” node has been deprecated and we encourage everyone to switch to using “Show External Login UI” in their Blueprints. This returns control of the login process and UI to the game, so you’re free to activate it at a time that’s appropriate for you. Many games will be able to call it during a BeginPlay event - this will be after the engine has been initialized and any startup movie has finished playing.

cd718d043037fd74708c95d3f6355e38803b64c6.png

In addition, we have implemented IOnlineIdentity::Logout for Google Play, and exposed “Logout” and “Is Logged In” Blueprint nodes. Using these, it should now be possible to implement a sign-in/sign-out button, as recommended by Google’s quality checklist.

e572e4771cd5e3685bf5283dd4cb584a50df8f17.png

ff060b3cdf51072e7412dc19baf78ae85130f42c.png

Feel free to post any feedback about these changes here - though for specific bug reports, please post them on AnswerHub!

Just last week a poster wished you could sign in whenever rather then at the start and it’s already implemented.
Good job!

Great ill try this out right now. Every build fails for me after 4.4 with google play services enabled (already have a topic running here: https://answers.unrealengine.com/questions/253779/cant-alpha-test-from-google-play.html)

how does this interact with the JNI local reference table? As that is the problem I’m having I’m wondering if this will interact with the JNI differently as it doesn’t get loaded at engine start now and we can finally have people choose to log in or out with for example a button.

So the button and workflow actually works, to bad logging into google play services still make a game crash.

https://answers.unrealengine.com/questions/253779/cant-alpha-test-from-google-play.html ← makes building games for Android quite useless at the moment.

I doubt this is related. We are currently using Google’s C++ SDK for Play Games services, so we don’t have access to the JNI that interacts with Google Play, it’s all compiled into Google’s library. The new login flow does mean that instead of initializing the Google Play library at engine startup, it will be initialized the first time a login call is made - so any JNI calls that the Google C++ library makes during the login process will occur a bit later. That’s the only difference that comes to mind.

Well indeed you changed the library and the way UE4 interacts with it between 4.3 and 4.8 and I think UE4 is handling it wrong. A JNI overflow (512 characters max etc) only happens when local references do not get deleted/unloaded/destroyed (how ever you want to call it) it’s being looked at by one of epic’s staff at the moment and I hope it will be fixed @ 4.10

When using the cache achievements node it also makes a call to get all achievements. I’m using the same as Tappy Chicken to handle the achievements and leaderboards yet on login the game always crashes with the JNI error overflow. I think it’s because of Incremental Achievements not being handled as it should some how (local references don’t get deleted)

Anyway I’m going off-topic here sorry. The new login system itself as described in this topic works as intended.

The [is Logged In] node doesn’t seem to work properly and still assumes a player is logged in by default. I have the [is logged in] node branched to see if it’s true or false. Even without signing into Google Play Services (as it still makes my game crash) it should return false and not poll the leader boards how ever it still polls the leaderboards even when the [is logged In] node should return false (and not poll the leaderboards in my setup)

Hi. This new login flow is great for most purposes. I have a question about the “show external login UI” node in blueprints:

When is the “On success” event or “On failure” event executed?
Is it when the login screen shows up, or when the user presses login or cancel?

When my game starts it will show the external login UI and then, if successful, it will try to read from the leaderboard. So I want it to wait until the user has pressed login before it fires the event “On Success” or “On Failure”.

Thanks

And in fact the read leaderboard integer node doesn’t seem to be working at all in 4.9

The success or failure pin will execute after the user has interacted with the system UI - “on success” after the user presses login and “on failure” if the login failed or after the user pressed cancel. “On success” might also fire without the system UI appearing, if Google Play could log the user in automatically.

I’m not aware of any changes to leaderboard handing between 4.8 and 4.9, although as before it will require a successful login to work properly. If you’re sure you’re reading the leaderboard after a successful login, and it appears to be a bug, feel free to post a bug report on Answerhub.

Thanks for the reply. That is perfect. However, after successful login the read leaderboard integer will always fail and fire its On Failure event instead of the On Success event. Write to leaderboard and showing the leaderboard works perfectly, so I think it might be a bug. Hence I have posted it on answerhub as you suggested and hope they will figure it out.

I am using “Show External Login UI” node on Begin Play of my Level BP. When I launch it on my Android device, it executes the print node present in “On Failure” execution pin always.

Hi ambhar,

Is your project set up correctly to use Google Play Games? Basic instructions can be found in this thread. If so, please check the logcat output, it may have more information to help figure out what’s going on.