Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show a Google Play Games "Welcome Back" toast for android on Unity3D?

I'm already using the official plugin, logging in for the first time works perfectly and we can see the "Welcome + username" with a little avatar message popping up.

However, I do not see the "Welcome back" message that supposedly should appear whenever the user logs in silently (not showing a login prompt). In some games such as Crossy Road you do get the "Welcome" popup if the user silently logs in.

A little example of what I am doing using minimal code:

using UnityEngine;
using System.Collections;
using GooglePlayGames;
using UnityEngine.SocialPlatforms;
using UnityEngine.UI;

public class GooglePlayLogic : MonoBehaviour {

    void Start ()
    {
        PlayGamesPlatform.Activate ();
        SilentSignIn();
    }

    public void SilentSignIn()
    {
        if (!PlayGamesPlatform.Instance.localUser.authenticated)
        {
            PlayGamesPlatform.Instance.Authenticate ((bool success) => {
                if (success) {
                     //some code here
                 } else {
                    //some code here
                 }
            }, true); //true means no login prompt will show up
        } else {
            Debug.Log("Already signed in");
        }
    }
}

However, the normal "Welcome" popup always shows up if the user manually logs out and then logs in again. The issue here is that no message is showing up after the silent log in. What do I do for that to appear?

like image 809
wessy Avatar asked Jan 27 '26 15:01

wessy


1 Answers

Very simple. You have to call Android's native toast method.

Try this: Toast on Image Detection in Vuforia either using Unity or Java without C++

like image 130
Sanket Prabhu Avatar answered Jan 30 '26 04:01

Sanket Prabhu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!