Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Vaell · Apr 26, 2017 at 05:58 PM · google playgooglegoogle-play-store

Google Play Services Singleton HELP!

Firstly Hello, I am new to Unity and coding.. I made simple Trivia game which has 5 scenes in it. Now I want to publish it to Google Play Store but before I need to add Google Play Services to game. I tried many things but I failed. I think I must make with singleton but I don't know how to do it. Maybe someone can help me or show the way... I installed GitHub Plugin and made setup for android. Also followed the GitHub's instructions but did not worked... Any suggestions or help ?

Thanks anyway!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by paradox9 · May 25, 2017 at 02:57 PM

@Vaell Hi,

this might help :-

  1. Create a new Empty object in your starting scenes (maybe your menu scene)

  2. Create a new C# Script : PlayGameManager.cs

      using UnityEngine;
         using GooglePlayGames;
         using GooglePlayGames.BasicApi;
         using UnityEngine.SocialPlatforms;
         
         public class PlayGameManger : MonoBehaviour {
         
             public static PlayGameManger Instance{ set; get;}
             public bool isLogedIn;
             void Awake () {
                 if (Instance == null) {
                     Instance = this;
                     isLogedIn = false;
                     PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder ().Build();
                     PlayGamesPlatform.InitializeInstance (config);
                     PlayGamesPlatform.DebugLogEnabled = true;
                     PlayGamesPlatform.Activate ();
                     SignIn ();
                     DontDestroyOnLoad (gameObject);
                 } else {
                     Destroy (gameObject);
                 }
             }
         
             public void SignIn(){
                 if (isLogedIn == false) {
                     Social.localUser.Authenticate (success => {
                         isLogedIn = success;
                         //Debug.Log("Signin : "+success);
                     });
                 }
             }
     // your Achievements and other code here
     }
    
    
  3. Add this script to that new Empty object.

  4. to access properties from this script in other scripts, eg.:

    //in other script if (PlayGameManger.Instance != null) { PlayGameManger.Instance.ShowLeaderboardsUI (); }

  5. Done! this script will available in all scenes

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Akki-bhatt · Aug 19, 2017 at 05:23 AM

You can get full play service integration here : http://u3d.as/UHs

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

101 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity Google Play Services 2 Answers

What is "good" Install/Uninstall rate for growing-good apps? 0 Answers

I made a build using asset delivery and when I try to put it on the play console it gives me the following error 0 Answers

[Google Play Services] Real Time Multiplayer doesn't work! Do not create a room! 1 Answer

Google Mobile Ads cause Failed to build apk error 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges