Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 谷歌游戏服务检查用户是否登录Unity3d_Android_Authentication_Logging_Unity3d_Google Play Games - Fatal编程技术网

Android 谷歌游戏服务检查用户是否登录Unity3d

Android 谷歌游戏服务检查用户是否登录Unity3d,android,authentication,logging,unity3d,google-play-games,Android,Authentication,Logging,Unity3d,Google Play Games,我想检查用户是否已登录,如果已登录,我将检查是否有成就 我是这样写的: void Update() { Social.localUser.Authenticate((bool success) => { Social.ReportProgress("Cfjewijawiu_QA", 100.0f, (bool success) => { // handle success or fa

我想检查用户是否已登录,如果已登录,我将检查是否有成就

我是这样写的:

 void Update()
    {
         Social.localUser.Authenticate((bool success) => {
               Social.ReportProgress("Cfjewijawiu_QA", 100.0f, (bool success) => {
                      // handle success or failure
               });
         });
    }
在此,如果用户未登录,则会持续请求登录

为了防止这种情况,我只想检查用户是否已登录

如何做到这一点


谢谢

一种解决方案是在Start()中执行此操作。这样,authenticate方法只在每个帧上调用一次

要回答您的问题,您可以使用经过身份验证的属性:

void Update()
    {
         if (Social.localUser.authenticated) {
               Social.ReportProgress("Cfjewijawiu_QA", 100.0f, (bool success) => {
                      // handle success or failure
               });
         }
    }