Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
0
Question by xmember · Mar 04, 2015 at 03:49 AM · google play gamesandroidpluginrealtime

Google Play Realtime Quick Match Fails

I'm developing a game using Google Play for realtime multiplayer. The plugin I used is the Google official one: https://github.com/playgameservices/play-games-plugin-for-unity.

Basically I followed every step based on the documentation. I'm able to sign in, post score and see the leaderboard. However, I failed every time creating a quick game. The console shows that after calling quickGame(), OnRoomSetupProgress(float percent) method was actually never called. It directly goes to OnRoomConnected(bool success) which fails every time.

I tried to create a quick game from invitation. I was able to see my friend list in Google Play UI, but I didn't receive any invitation and the game creation failed too. I really don't know what I did wrong.

Thanks in advance for any help I could get. My codes here:

 using UnityEngine;
 using System.Collections;
 using UnityEngine.UI;
 using UnityEngine.SocialPlatforms;
 using GooglePlayGames;
 using GooglePlayGames.BasicApi;
 using GooglePlayGames.BasicApi.Multiplayer;
 using System.Collections.Generic;
 
 
 public class GP : MonoBehaviour, RealTimeMultiplayerListener{
     
         const string learderboard="xxx";
         const int MinOpponents = 1, MaxOpponents = 1;
         const int GameVariant = 0;
 
         // Variables for implementing interface
         public bool m_roomLoaded = false;
         public bool m_peerConnected = false;
         public float m_roomProgress = 0.0f;
         public bool m_messageReceived = false;
         public string m_message = "";
         Invitation mIncomingInvitation = null;
 
         // Use this for initialization
         void Start () {
             PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
                 // registers a callback to handle game invitations.
                 .WithInvitationDelegate(OnInvitationReceived) 
                     .Build();
             
             PlayGamesPlatform.InitializeInstance(config);
             
             // recommended for debugging:
             PlayGamesPlatform.DebugLogEnabled = true;
             PlayGamesPlatform.Activate ();
             Login ();
         }
 
         public void Login()
         {
             Social.localUser.Authenticate((bool success) => {
                 if(success)
                 {
                     print ("Success logged in");
                 }
                 else
                 {
                     print ("log in failed");
                 }
             });
         }
 
         public void PostScore()
         {
             Social.ReportScore(12345, learderboard, (bool success) => {
                 if(success)
                 {
                     print("posted score");
                 }
                 else
                 {
                     print("post failed");
                 }
             });
         }
 
         public void ShowLeaderboard()
         {
             PlayGamesPlatform.Instance.ShowLeaderboardUI(learderboard);
         }
 
         public void SignOut()
         {
             PlayGamesPlatform.Instance.SignOut();
         }
 
         public void quickGame()
         {
             PlayGamesPlatform.Instance.RealTime.CreateQuickGame(1, 1, 0, this);
         }
 
         public void inviteFriendGame()
         {
             PlayGamesPlatform.Instance.RealTime.CreateWithInvitationScreen(MinOpponents, MaxOpponents,GameVariant,this);
         }
 
         public void accept_inbox()
         {
             PlayGamesPlatform.Instance.RealTime.AcceptFromInbox(this);    
         }
 
 //        public void acceptInvitation()
 //        {
 //            //Invitation invitation = ....;  // (obtained via delegate)
 //            PlayGamesPlatform.Instance.RealTime.AcceptInvitation(invitationId, invitation.InvitationId);
 //        }
 
         // implement the realtime listener interface
         public void OnRoomSetupProgress(float percent) {
             m_roomProgress = percent;
             print(m_roomProgress);
         }
         
         public void OnRoomConnected(bool success) {
             m_roomLoaded = success;
             if (success) {
                 print(“Success”);
             } else {
                 print(“Error”);
             }
         }
 
         public void getParticipantID()
         {
             Participant myself = PlayGamesPlatform.Instance.RealTime.GetSelf();
         }
 
         public List<Participant> getPlayerList()
         {
             List<Participant> participants = PlayGamesPlatform.Instance.RealTime.GetConnectedParticipants();
             return participants;
         }
 
         public void OnLeftRoom() {
             m_roomLoaded = false;
         }
         
         public void OnPeersConnected(string[] participantIds) {
             m_peerConnected = true;
         }
         
         public void OnPeersDisconnected(string[] participantIds) {
             m_peerConnected = false;
         }
 
         public void OnRealTimeMessageReceived (bool isReliable, string senderId, byte[] data)
         {
             throw new System.NotImplementedException ();
         }
 
         public void LeaveGame()
         {
             PlayGamesPlatform.Instance.RealTime.LeaveRoom();
         }
 
         public void OnInvitationReceived(Invitation invitation, bool shouldAutoAccept) {
             if (shouldAutoAccept) {
                 // Invitation should be accepted immediately. Instance happens if the user already
                 // indicated (through the notification UI) that they wish to accept the invitation,
                 // so we should not prompt again.
                 ShowWaitScreen();
                 PlayGamesPlatform.Instance.RealTime.AcceptInvitation(invitation.InvitationId, this);
             } else {
                 // The user has not yet indicated that they want to accept Instance invitation.
                 // We should *not* automatically accept it. Rather we store it and 
                 // display an in-game popup:
                 mIncomingInvitation = invitation;
             }
         }
 
         void ShowWaitScreen()
         {
             //To Do..
         }
     
 }

Comment
Add comment · Show 1
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 meat5000 ♦ · Mar 03, 2015 at 11:11 PM 0
Share

Have you tried adding in some debug code to get some feedback from whats going on?

0 Replies

· Add your reply
  • Sort: 

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

GooglePlayGames plugin path not correct? 0 Answers

Google play services OnSceneProcess slows down play on editor 1 Answer

Unsupported major.minor version 52.0 - Android Build Error 2 Answers

Gradle failed to fetch dependencies for Firebase and Google Play Service 1 Answer

Google Play games Services Multiplayer 1 Answer


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