Skip to content

Smart Store

The in-game store is the place to generate money for your game! A good store usually has a variety of items players need during the game. For the convenience of navigation, developers usually split all the content into different pages, such as Gems, Gold, Limited Offers, Super Packs, Event Items, etc… Each page contains several slots with different prices.

Follow the instructions to add a Store to your game:

  1. Add the LiveOps package to your game.
  2. Open Smart Config by clicking the settings button(to the right from the LiveOps header).
  3. Edit Store Pages and Store Slots in the Store cell of the table.
  4. Each Store Page has a Condition to be available and a list of Store Slots.
  5. Each Store Slot has a Condition to be available, a reference to the Store Item and a Visual Badge.

Screenshot

You can preview your work using our Demo project. It should look like this:

Screenshot

Slot Types

Balancy has several built-in slot:

Name Description
Store Slot Default Slot
First Purchase Bonus Such slot gives an extra bonus when purchased for the first time. Watch this video
Periodic Slot Such slots can be purchased limited times during the specified period of time. For example: maximum 2 times a day.
Slot with Cooldown Once the slot is purchased it'll be set on the cooldown. While on cooldown you can't purchase it again.

Section for programmers

  1. Use the following code to access the Store config and read all active Store Pages and Slots.

    var smartConfig = Balancy.DataManager.SmartObjects.SmartConfig;
    var pages = smartConfig.ActivePages;        
    foreach (var page in pages)
    {
        foreach (var activeSlot in page.ActiveSlots)
        {
            //TODO write your code here
        }
    }
    
  2. Due to Conditions being actively used in Store Pages and Slots, the store can be updated at runtime. You should subscribe to such events and handle them:

    smartConfig.OnStoreUpdatedEvent
    page.OnStorePageUpdatedEvent
    
  3. Another way to track the changes in the Store is to register LiveOps Listener:

    ExternalEvents.RegisterLiveOpsListener(new LiveOpsStoreEventsExample());
    

Example:

  1. Find the Prefab called ExampleStore and place it in the Scene.
  2. After the game starts and Balancy is initialized, call the following method(winStore is the link to the WinStore script on the ExampleStore gameObject):

    winStore.Init(DataManager.SmartObjects.SmartConfig);
    
  3. Enjoy the demo. And remember - you can use the source code we provided as you wish.