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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Solved: Issue with Social.localUser.Authenticate

Discussion in 'Android' started by PLANET-HEAD, Jan 11, 2016.

  1. PLANET-HEAD

    PLANET-HEAD

    Joined:
    Jul 19, 2015
    Posts:
    6
    Hi guys I'm new to coding as you'll probably be able to tell.

    I've hit a wall while setting up Google Play Games Services plugin. I'm sure I've done all the setup correctly but when adding code to a UI button to initiate login into Google Play I'm getting this error:

    unityissue.png

    I'm pretty sure I've copied everything from the Github documentation but nothing I do fixes it and I can't find anything online to help.

    Hoping you have some ideas!
     
  2. wgt_jimmy

    wgt_jimmy

    Joined:
    Dec 22, 2014
    Posts:
    39
    try adding this to the top of the file:
    using UnityEngine;
     
  3. PLANET-HEAD

    PLANET-HEAD

    Joined:
    Jul 19, 2015
    Posts:
    6
    Sorry I should have taken a screen of the whole thing. That's already on there. Here's the code in full:

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

    public class SocialLogin : MonoBehaviour {

    void start() {

    PlayGamesPlatform.Activate();

    }

    public void onClick() {

    Social.localUser.Authenticate((bool success) => {
    // handle success or failure
    });

    }
     
  4. wgt_jimmy

    wgt_jimmy

    Joined:
    Dec 22, 2014
    Posts:
    39
    Seems odd - which version of Unity are you using? What happens when you press the Ctrl + (show potential fixes)?
     
  5. PLANET-HEAD

    PLANET-HEAD

    Joined:
    Jul 19, 2015
    Posts:
    6
    Yeah I thought it did. I'm using 5.3.1f and this is what I get:

    unityissue2.png

    I've had trouble updating the Google Play SDKs in the SDK managaer, not sure if that's got anything to do with it? I would have thought it was unlikely to be.
     
  6. PLANET-HEAD

    PLANET-HEAD

    Joined:
    Jul 19, 2015
    Posts:
    6
    I clicked the first Generate field option and now the red squiggly has moved to Authenticate with the same "does not contain a definition" error message :(
     
  7. PLANET-HEAD

    PLANET-HEAD

    Joined:
    Jul 19, 2015
    Posts:
    6
    Managed to undo that but back to square one basically :'(
     
  8. PLANET-HEAD

    PLANET-HEAD

    Joined:
    Jul 19, 2015
    Posts:
    6
    Solved: I stupidly called another script Social and, even though I later renamed it, it was still calling back to that rather than the Social API. Deleted the other script and now all is working ok by the looks. Thanks for your help!