Playgama
  • Welcome
  • 🚀Quick start
  • Submitting a game
  • Game Requirments
    • 💥Self-check
    • Technical Requirements
    • Advertising Requirements
    • User Experience Requirements
    • Content Requirements
    • Other Requirements
    • Platform-Specific Requirements
  • In-Game Purchases
    • Step-by-step IAP integration guide for Unity
  • FAQ
    • General
    • Submitting a Game
    • Game Moderation
    • Payments and Statistics
  • SDK
    • Getting started
    • Engines
      • Core (Plain JS)
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Unity
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Construct 3
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • GDevelop
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Godot
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Game Maker
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
      • Defold
        • 💥Intro
        • Setup
        • Platform Parameters
        • User Data
        • Advertising
          • Banner
          • Interstitial
          • Rewarded
          • AdBlock
        • User Parameters
        • Social Interactions
        • Leaderboards
        • Achievements
        • In-Game Purchases
        • Remote Configuration
    • Changelog
  • For Partners
    • Getting Started
    • Embed the Widget
      • Adding Games Widget to Your WordPress Site
      • Adding Games Widget to Your Tilda Site
      • Adding Games Widget to Your Framer Site
    • Import the Game Catalog
    • Share your referral link
Powered by GitBook
On this page
  1. SDK
  2. Engines
  3. Unity

Platform Parameters

PreviousSetupNextUser Data

Last updated 25 days ago

At any time, you can retrieve values for specific parameters that you might use in your game, such as the user's browser language.

Platform ID

Identify the platform on which the game is currently running to customize features and settings accordingly.

Bridge.platform.id

Returns the platform ID on which the game is currently running. Possible values: playgama, vk, ok, yandex, facebook, crazy_games, game_distribution, wortal, playdeck, telegram, y8, lagged, msn, poki, qa_tool, mock.

Language

Check the language to display proper text labels.

Get the language set by the user on the platform or the browser language if not provided by the platform, to localize game content.

Bridge.platform.language

Returns the language set by the user on the platform. If the platform does not provide this data, it returns the browser language. Format: ISO 639-1. Example: ru, en.

URL Parameter

Embed auxiliary information into the game URL to pass additional data or settings when launching the game.

Bridge.platform.payload

Allows embedding auxiliary information into the game URL.

Platform
URL Format

VK

http://vk.com/game_id#your-info

Yandex

http://yandex.com/games/app/game_id?payload=your-info

Crazy Games

crazygames.com/game/game_name?payload=your-info

Mock

site.com/game_name?payload=your-info

Domain Information

Retrieve the top-level domain of the platform to handle domain-specific configurations and behavior.

Bridge.platform.tld

Returns the top-level domain (TLD) of the platform. If there is no data – null. If the data is available – com, ru, etc.

Is Get All Games Supported

Verify whether the platform supports the GetAllGames method to retrieve the correct links to the developer's other games.

Bridge.platform.isGetAllGamesSupported

Is Get Game By Id Supported

Verify whether the platform supports the GetGameById method to retrieve the correct link to a specific game.

Bridge.platform.isGetGameByIdSupported

Get All Games

This method retrieves the correct links to the developer's other games.

private void Start()
{
    Bridge.platform.GetAllGames((success, games) => {
        Debug.Log($"OnGetAllGamesCompleted, success: {success}, games:");

        if (success) {
            switch (Bridge.platform.id)
            {
                case "yandex":
                    foreach (var game in games) {
                        Debug.Log($"App ID: {game["appID"]}");
                        Debug.Log($"Title: {game["title"]}");
                        Debug.Log($"URL: {game["url"]}");
                        Debug.Log($"Cover URL: {game["coverURL"]}");
                        Debug.Log($"Icon URL: {game["iconURL"]}");
                    }
                    break;
            }
        }
    });
}

Get Game By Id

This method retrieves the correct link to a specific game from the developer.

private void Start()
{
    var options = new Dictionary<string, object>();

    switch (Bridge.platform.id)
    {
        case "yandex":
            options.Add("gameId", "111111");
            break;
    }

    Bridge.platform.GetGameById(options, (success, games) => {
        Debug.Log($"OnGetAllGamesCompleted, success: {success}, games:");

        if (success) {
            switch (Bridge.platform.id)
            {
                case "yandex":
                    Debug.Log($"App ID: {game["appID"]}");
                    Debug.Log($"Title: {game["title"]}");
                    Debug.Log($"URL: {game["url"]}");
                    Debug.Log($"Cover URL: {game["coverURL"]}");
                    Debug.Log($"Icon URL: {game["iconURL"]}");
                    Debug.Log($"Is Available": {game["isAvailable"]}");
                    break;
            }
        }
    });
}    

The call to Bridge.platform.SendMessage with the parameter PlatformMessage.GameReady is mandatory!

Don't forget to implement it.

Send predefined messages to the platform to trigger specific actions or events, such as signaling that the game is ready.

Bridge.platform.SendMessage(PlatformMessage.GameReady)
Message
Description

GameReady

The game has loaded, all loading screens have passed, and the player can interact with the game.

InGameLoadingStarted

Some loading inside the game has started. For example, when a level is loading.

InGameLoadingStopped

Loading inside the game is finished.

GameplayStarted

Gameplay has started. For example, the player has entered a level from the main menu.

GameplayStopped

Gameplay has ended/paused. For example, when exiting from a level to the main menu or opening the pause menu.

PlayerGotAchievement

The player has reached a significant milestone. For example, defeating a boss or setting a new record.

Server Time

private void Start()
{
    Bridge.platform.GetServerTime(OnGetServerTimeCompleted);
}

private void OnGetServerTimeCompleted(DateTime? result)
{
    if (result.HasValue)
    {
        Debug.Log(result.Value); // UTC time
    }
}

Current Visibility State

Check if the game tab is visible or hidden, and adjust game behavior accordingly, such as muting sound when hidden.

Bridge.game.visibilityState

Returns the current visibility state of the game (the tab with the game). Possible values: visible, hidden.

// To track visibility state changes, subscribe to the event
private void Start()
{
    Bridge.game.visibilityStateChanged += OnGameVisibilityStateChanged;
}

private void OnGameVisibilityStateChanged(VisibilityState state)
{
    switch (state)
    {
        case VisibilityState.Visible:
            // The game tab is visible
            break;
        case VisibilityState.Hidden:
            // The game tab is hidden
            break;
    }
}

React to changes in visibility state. For example, mute the game sound when the state is hidden and unmute when the state is visible.

Sending a Message to the Platform