Dubbz Docs
  • Welcome
    • Introduction
    • Pricing
    • User Payments
    • Onboarding
    • Legal and Compliance
  • Get Started
    • Choosing your Integration Path
    • Generate your API Key
    • HTTP API
      • Dubbz in Your Game
        • User Registration
          • Get user signature
          • Register User
        • Async Challenge
          • Create Wager Match
          • User Confirm Match
          • Report Score
        • PVP
          • Create Wager Match
          • User Confirm Match
          • Report Score
      • Your game in Dubbz
        • Async Challenge
          • Create Match
          • Report Score
        • PVP
          • Create Match
          • Report Score
    • Unity SDK
      • Installation Preparation
      • Configuration
      • Usage
  • Resources
    • FAQ
    • Contact us
Powered by GitBook
On this page
  1. Get Started
  2. Unity SDK

Usage

  1. Add DubbzAdapter.prefab: Place the DubbzAdapter.prefab (found at Assets > DubbzSDK > Prefabs > DubbzAdapter.prefab) on the first loaded scene of your game, typically the main menu.

  2. Create a Challenge Button: On the main menu screen, create a button labeled “Challenge.” This will be the user's entry point to the wagering functionality.

  3. Singleton Access: The DubbzAdapter acts as a singleton and can be accessed from any scene within your game. The SDK initializes itself on the Awake method of the prefab.

  4. Implementing Methods and Events:

    • Open Challenge: Use DubbzAdapter.OpenChallenge() when the user clicks the “Challenge” button. This method opens up the challenge UI for the player.

    • Subscribe to CreatedArcadeMatch Event: Listen for the DubbzAdapter.CreatedArcadeMatch event. When this event is triggered, integrate your match start logic using the gameId and tournamentId parameters received.

      DubbzAdapter.CreatedArcadeMatch += (gameId, tournamentId) => {
          // Implement match start logic here
      };
    • Track Match Start: After receiving the CreatedArcadeMatch event and successfully initiating a match on your server, call DubbzAdapter.TrackMatchStart(string tournamentId, Action onSuccess, Action onError). This confirms the match start with Dubbz.

    • Cancel Match: If there's a failure in any response sent to your server during match start, use DubbzAdapter.CancelMatch(string tournamentId) to cancel the match.

    • Set Active Dubbz Widget: Control the visibility of the Dubbz widget in your game UI with DubbzAdapter.SetActiveDubbzWidget(bool active). Set to true to show and false to hide the widget.

    • Show Match Result: Once the match concludes, call DubbzAdapter.ShowMatchResult() to display the Dubbz SDK “Match Results” screen to the players.

PreviousConfigurationNextFAQ

Last updated 1 year ago