Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Google play PlayGamesClientConfiguration problems

Discussion in 'Android' started by KRgames_, May 8, 2022.

  1. KRgames_

    KRgames_

    Joined:
    May 5, 2022
    Posts:
    1
    Hi!

    I'm facing the problem that the Play Games plugin is unfortunately not working properly. The error is that the PlayGamesClientConfiguration function is underlined in red in the editor and gives this error message:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using GooglePlayGames;
    5. using GooglePlayGames.BasicApi;
    6.  
    7. public class playGameServices : MonoBehaviour
    8. {
    9.     void Start()
    10.     {
    11.         Initialize();
    12.     }
    13.  
    14.     private void Initialize()
    15.     {
    16.         PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().RequestServerAuthCode(false).Build();
    17.         PlayGamesPlatform.InitializeInstance(config);
    18.         PlayGamesPlatform.DebugLogEnabled = true;
    19.         PlayGamesPlatform.Activate();
    20.         SignInUserWithPlayGames();
    21.     }
    22.  
    23.     void SignInUserWithPlayGames()
    24.     {
    25.         if (!Social.localUser.authenticated)
    26.         {
    27.             Social.localUser.Authenticate(success => {
    28.                 if (success)
    29.                 {
    30.                     // signed in
    31.                 }
    32.             });
    33.         }
    34.     }
    35. }
    36.  
    37.  
    Code (CSharp):
    1. Error   CS0246   The type or namespace name 'PlayGamesClientConfiguration' could not be found (are you missing a using directive or an assembly reference?)   Assembly-CSharp   C:\...\Assets\playGameServices.cs   16

    What could be the solution? Thank you.
     
    openunity and RyanTexture like this.
  2. Sidd_Code

    Sidd_Code

    Joined:
    May 3, 2020
    Posts:
    2
    I got the same error, it was working just fine a day ago.

    Try this:
    (As vs code is not recognising the referenced assembly, which in this case is GooglePlayGames.BasicApi which contains the 'PlayGamesClientConfiguration'.)

    1. You have to switch from any other platform to Android(If that solves ur issue, Congratulations we can't be frds)

    2. Not sure but try different version of unity(mostly LTS) it may lead to some changes in api.

    3. You can try to mannualy give reference to GooglePlayGames.BasicApi(Find it urself, i don't know how to do that. Research it) then this can get the error resolved!

    4. Again not sure but, if any of above doesn't work try to change Api Compatibility Level to .NET 4.x in Edit>Project Settings>Player>(of course Android section)>Other Settings>Configuration>Api Compatibility Level. If u didn't find .NET 4.x in drop-down their, Add It! (Find the way urself how to add it).

    Warning: if you change it to .NET 4.x then u may face some errors, which may create more mess and lead you to do more work but trust me which is easily fixable.

    If you find the solution immediately inform me here as I'm trying to solve it myself. If i find the perfect solve i will inform you here too! Thanks.
     
    openunity likes this.
  3. RyanTexture

    RyanTexture

    Joined:
    Jun 10, 2020
    Posts:
    16
    Hello! i was learning the same thing this weekend and i came across a pinned comment on a tutorial ( tutorial :
    )

    so for version 0.11.01 there isnt PlayGamesClientConfiguration anymore!

    hope this helps.

    the message is as follows :

    Code (CSharp):
    1. Hey all Just just going to pin this here quickly. If anyone experiences issues when either upgrading GPGS to the newest version 0.11.01 or is starting the project after that point they've made some major changes, primarily that you no longer need to Initialize or Activate in order to call the authentication.
    2.  
    3. Note: this is for the messages about PlayGamesClientConfiguration not existing, it is no longer required!
    4.  
    5. Note for 0.11.1
    6.  
    7. The new SDK contains four major changes to increase sign-in success which you
    8. should be aware of:
    9.  
    10. 1. Sign-in is triggered automatically when your game is launched. Creating a
    11. PlayGamesClientConfiguration instance, the initialization and activation of
    12. PlayGamesPlatform are not needed. Just calling
    13. `PlayGamesPlatform.Instance.Authenticate()` will fetch the result of automatic
    14. sign-in.
    15. 2. Authentication tokens are now provided using
    16. `PlayGamesPlatform.Instance.requestServerSideAccess()`.
    17. 3. Sign-out method is removed, and we will no longer require an in-game button
    18. to sign-in or sign-out of Play Games Services.
    19. 4. Extra scopes cannot be requested.
    20.  
    21. Before importing the unity package for v0.11.1, delete everything under
    22. `Assets/GooglePlayGames`. You can then follow the regular integration process.
     
  4. FFn113

    FFn113

    Joined:
    Dec 30, 2019
    Posts:
    1
    After searching for couple hours and checking all the scripts and references in GPGS plugin, I thought that would be the case. So if you guys need any reference to how to implement this, you can check out the sample project in Github.

    https://github.com/playgameservices/play-games-plugin-for-unity/tree/master/Samples/SmokeTest
     
    openunity likes this.
  5. ckocank

    ckocank

    Joined:
    Sep 29, 2020
    Posts:
    9
    go back and use version 10.14
     
  6. unity_TkvnlsDCpw-owg

    unity_TkvnlsDCpw-owg

    Joined:
    Jul 16, 2020
    Posts:
    20
    will it work if we use 10.14 ? even when 11 is there..
     
  7. mohamedshuaib

    mohamedshuaib

    Joined:
    Nov 19, 2021
    Posts:
    1
    Yes.
     
  8. unity_TkvnlsDCpw-owg

    unity_TkvnlsDCpw-owg

    Joined:
    Jul 16, 2020
    Posts:
    20
    Thanks
     
  9. innervarie

    innervarie

    Joined:
    Jul 22, 2018
    Posts:
    1
    any idea why
    PlayGamesPlatform.Instance.Authenticate(AuthGPSAuthentication);
    just cancels it does a popup and shows a loading spinner and then it just disappears and leaves a canceled status
     
    openunity likes this.
  10. ben_11_oujda

    ben_11_oujda

    Joined:
    Oct 25, 2022
    Posts:
    2
    i was using plugin version 0.11 and its was not working for me even i try every solution i found, so i delete it and use plugin version 0.10.14 and change to code to be for 0.10.14 after that everythings work perfectly (login to google play, leaderboard, achievement).
     
    openunity likes this.
  11. rasmuskidmosebendtsen

    rasmuskidmosebendtsen

    Joined:
    Jun 17, 2021
    Posts:
    5
    I have same issue as Innervarie anyone found a solution?
     
  12. rasmuskidmosebendtsen

    rasmuskidmosebendtsen

    Joined:
    Jun 17, 2021
    Posts:
    5
    Nevermind figured out that the fingerprint thing was wrong for me remember to add your java dev kit bin folder to the path in environment variables
     
  13. RandreS230

    RandreS230

    Joined:
    Nov 27, 2018
    Posts:
    1
    Code (CSharp):
    1. private void Start()
    2. {
    3. #if UNITY_ANDROID
    4.      PlayGamesPlatform.Instance.Authenticate(delegate(SignInStatus status) { });
    5.      PlayGamesPlatform.DebugLogEnabled = true;
    6.      PlayGamesPlatform.Activate();
    7.      Social.localUser.Authenticate((bool succes) => { });
    8. #endif
    9. }
     
    Last edited: Mar 13, 2023
    Fraccas likes this.
  14. PanderGames

    PanderGames

    Joined:
    Nov 21, 2018
    Posts:
    2
    Do you know where I can find version 10.14? because everywhere I see it has already been removed.
     
  15. Netherzapdoss

    Netherzapdoss

    Joined:
    Dec 30, 2022
    Posts:
    3
    It's in the github, find the releases
     
  16. longfeijp

    longfeijp

    Joined:
    Sep 2, 2023
    Posts:
    1