Unity Google Play Services PlayGamesPlatform.Instance.GetAccessToken is empty or null

Recently, I’ve been playing around with Gamesparks and Google Play Games for Unity to create a turn based game on Android in Unity.

As I was following the tutorial I got stuck with an odd issue that prevented me from being able to get an access token back from the Google Play service for the device I was using.

I struggled to find an answer to this online, but then it clicked… The Google Play Games popup authorisation window never appeared.
So, first thing I tried to do was get that to display using the following code:

Now, in theory that should have worked perfectly well. However… that crashed the Unity player. Why? Well, after some digging around I found a comment on an issue in the Play Games Plugin For Unity Github by Tolgau that pointed to the issue being with the version 10.2.0. The work around was to replace all the 10.2.0 .aar files in the Android plugins directory with the 10.0.1 version. Following the instructions worked like a charm.

I deployed the game to my Android device, and lo and behold the Google Play Games window appeared, and after I authorised the app I started getting an access token from the PlayGamesPlatform.Instance.GetAccessToken() method.

Leave a comment