Add Required Calls

Init() for eventNames

To properly initialize challenges, you’ll need to pass a list of all the challenge eventNames you’re using within your game inside a Start () call. You can view this in the below Example 1A which uses eventNames from the Add Challenge Events section of this documentation.

This acts as a safeguard so the list of challenges returned to the player will only include eventNames that you've specified. This is particularly useful if you are considering challenges specific to an upcoming version of your game.

For example, v1.0 of your app may only include challenges with an eventName for "Pick up gold coins" but v1.1 could introduce green coins not included in v1.0. If you were to introduce a "Pick up green coins" eventName in v1.1, players viewing challenges in v1.0 would only see challenges with a "Pick up gold coins" eventName.

Init() for Versus button

To properly initialize the Versus button (Button_OpenVersus), you’ll need to initialize it in your Start () call. You can view this as well in the below Example 1A or in Assets/Versus/Scripts/VsUI_DemoGame.cs

Example 1A:

void Start (){

VsSettings settings = new VsSettings(
                new string[] { "Pick up gold coins", "Stay alive" },
                m_str_externalPlayerId
            );

Versus.VersusManager.Singleton.Init(settings);
GameObject.FindObjectOfType<VsUI_VersusButton>().Init();


}

Add callback for showing Challenge/Prize Won Popup

Players participating in Challenges are informed of challenge/prize wins and sweepstakes wins via popups. In order to show this popup during a game state you’d like to specify, please use the below callback:

VsCallbackManager.Singleton.SetWonChallengesCallback((_challenges) =>
  {
  VersusManager.Singleton.GetPrizes(n_pageId, (NetRequestStatus netStatus) =>
              {
                   VsUI.Singleton.ShowPopUpsForNewPrizes();
                      });
          });

Add call to award in-game DLC prize

To know when to award your in-game DLC prize, please use the below callback.

You can see an example of this in Assets/Versus/Scripts/VsUI_DemoGame.cs/

VsCallbackManager.Singleton.SetFulfillPrizeCallback((prize) =>
            {
             if (prize.displayName == "Your Prize Name"){
                   GivePrize(); // Your game's logic to award prize
              }
                 return true;
            });

Add call mark in-game DLC prize as fulfilled in Versus platform

When awarding an in-game DLC prize for a challenge, be sure to call Versus.VersusManager.Singleton.MarkPrizeFulfilled() to mark your prize as fulfilled in the Versus platform.

// passing your DLC prize as a vsPrize object

if(shouldFulfill) {
          Versus.VersusManager.Singleton.MarkPrizeFulfilled(vsPrize);
    
 }