internal static PlatformConfiguration CreatePlatformConfiguration()
        {
            #if UNITY_ANDROID
            var config = AndroidPlatformConfiguration.Create();
            config.EnableAppState();
            using (var activity = GetActivity())
            {
                config.SetActivity(activity.GetRawObject());
                config.SetOptionalIntentHandlerForUI((intent) =>
                {
                    // Capture a global reference to the intent we are to show. This is required
                    // since we are launching the intent from the game thread, and this callback
                    // will return before this happens. If we do not hold onto a durable reference,
                    // the code calling us will clean up the intent before we have a chance to display
                    // it.
                    IntPtr intentRef = AndroidJNI.NewGlobalRef(intent);

                    PlayGamesHelperObject.RunOnGameThread(() =>
                    {
                        try
                        {
                            LaunchBridgeIntent(intentRef);
                        }
                        finally
                        {
                            // Now that we've launched the intent, release the global reference.
                            AndroidJNI.DeleteGlobalRef(intentRef);
                        }
                    });
                });
            }

            return(config);
            #endif

            #if UNITY_IPHONE
            if (!GameInfo.IosClientIdInitialized())
            {
                throw new System.InvalidOperationException("Could not locate the OAuth Client ID, " +
                                                           "provide this by navigating to Google Play Games > iOS Setup");
            }

            if (GameInfo.WebClientIdInitialized())
            {
                _GooglePlayEnableProfileScope();
            }

            var config = IosPlatformConfiguration.Create();
            config.SetClientId(GameInfo.IosClientId);
            return(config);
            #endif
        }
Exemplo n.º 2
0
        public PlatformConfiguration CreatePlatformConfiguration()
        {
            if (!GameInfo.IosClientIdInitialized())
            {
                throw new InvalidOperationException("Could not locate the OAuth Client ID, " +
                                                    "provide this by navigating to Google Play Games > iOS Setup");
            }

            if (GameInfo.WebClientIdInitialized())
            {
                _GooglePlayEnableProfileScope();
            }

            var config = IosPlatformConfiguration.Create();

            config.SetClientId(GameInfo.IosClientId);
            return(config);
        }