Hello,
I have a game that I inserted the google play services and admob plugins in, now everything works well, but when I click on the login button the game crashes! Below is the code:
Note that the game plays very good and the ads show up but when I click on the login button it crashes.
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using UnityEngine.SocialPlatforms;
// <copyright file="GPGSIds.cs" company="Google Inc.">
// Copyright (C) 2015 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
///
/// This file is automatically generated DO NOT EDIT!
///
/// These are the constants defined in the Play Games Console for Game Services
/// Resources.
///
public class LeaderScore : MonoBehaviour
{
public const string achievement_5 = "******************"; // <GPGSID>
public const string leaderboard_best_score = "******************"; // <GPGSID>
public const string achievement_1 = "******************"; // <GPGSID>
public const string achievement_2 = "******************"; // <GPGSID>
public const string achievement_3 = "******************"; // <GPGSID>
public const string achievement_4 = "******************"; // <GPGSID>
public BirdMovement playerScript6;
private static int MyScore;
// Use this for initialization
void Start()
{
PlayGamesPlatform.Activate();
MyScore = Score.highScore;
//PlayGamesPlatform.DebugLogEnabled = true;
GetComponent<Canvas>().enabled = false;
}
// Update is called once per frame
void Update()
{
if (playerScript6.dead)
{
GetComponent<Canvas>().enabled = true;
Social.ReportScore(MyScore, "***************", (bool success) => {
if (success)
{
Debug.Log("You've Successfully Logged In");
}
else
{
Debug.Log("Login Failed");
}
});
}
}
public void LoadLeaderUI(int level)
{
//Application.LoadLevel(Application.loadedLevel);
//PlayGamesPlatform.Instance.ShowLeaderboardUI("CgkIrsDSzs4HEAIQBg");
Social.localUser.Authenticate((bool success) =>
{
if (success)
{
Debug.Log("You've Successfully Logged In");
}
else
{
Debug.Log("Login Failed");
}
});
}
}