Studio GuideWorld SDK Guide
Log In

Utilizing Product Sample

STEP 1 : Starting with ZEPETO Product Sample

📘

ZEPETO Product


The following is a sample implementation of ZEPETO Product.

To understand the ZEPETO Product system, we recommend that you follow the guide to understand the implementation of the sample.

Samples include examples of currency systems, inventory systems, item acquisition, purchase, and UI resources.

1351

ZEPETO Product Sample UI

❗️

Caution

  • Please feel free to use the UI resources and scripts provided in the sample when you create the ZEPETO World.
  • However, it is prohibited to use the resources of the published samples other than ZEPETO World.

How to apply a sample of ZEPETO Product

  1. Please register the currency and products with the same name as those used in the sample at ZEPETO Studio.(If the currency ID and product ID are different, they cannot be linked with the sample.)

  • Currency
IDCurrency Name
starstar
energyenergy

  • Item Product
IDNameSales CurrencyPriceType
note1note1star10Nonconsumables
potion4potion4energy4Consumables
potion3potion3energy3Consumables
potion2potion2energy2Consumables
potion1potion1energy1Consumables

  • Currency Package Product
IDNameSales CurrencyPricePackage Configuration
energy4energy4ZEPETO ZEM4energy, 40
energy3energy3ZEPETO ZEM3energy, 30
energy2energy2ZEPETO ZEM2energy, 20
energy1energy1ZEPETO ZEM1energy, 10

  • Item Package Product
IDNameSales CurrencyPricePackage Configuration(item)
potion_packagepotion_packageZEPETO ZEM3potion4, 3
704

Package configuration example


  1. Import Product Canvas located in Assets/ProductSystem/Prefab into Scene.


  1. Open Project Setting > ZEPETO Service in your project to check if the World is properly connected.

  1. Run Unity menu bar > ZEPETO > Product > Settings.
  • If the currencies and product list are displayed well, the link will be successful.
  • You can verify that the icon image in the Assets>Product>Resources folder is set.
  • You can register the product's icon photo by using an image of your choice.

❗️

Caution

  • If you can't see the product properly, please check the following.
    • Please make sure that the account information logged in to the Unity Editor is the same as the World id creator's information.
    • Make sure that the connected world ID information in Project Settings > ZEPETO Service is correct.
    • Please confirm that you have registered the same id currencies and products as those used in the sample.

  1. Please turn on the multi-server and press the Play button to run the sample.


STEP 2 : Understanding the ZEPETO Product Sample

◦ Gain Energy : When you click a button, you get one energy product.

◦ Use Energy : When you click a button, you can deduct one energy item

◦ Increase EXP : Click the button to obtain experience value by 10. If you get an experience value and your level goes up, you get 5 Star currency.

◦ Acquire Random Item : Click the button to randomly add one of the four potion items to the inventory.

◦ Purchase Immediately : When you click the button, you can deduct one energy item and purchase Potion 1. The purchase window does not appear, and the purchased items are immediately in the inventory.

◦ Purchase through UI : Click the button and the purchase window will appear.You can purchase Note 1 by deducting 10 Star currency from the purchase window.

◦ Purchase ItemPackage : Click the button and the purchase window will appear.You can purchase potion package products by deducting ZEPETO ZEM from the purchase window.

  • Bag icon: Click on the button to display the inventory window. You can check the list of items you have, select them, and use them.

  • Shopping cart icon: When you click the button, the purchase window for energy currency appears. You can purchase currency package products by deducting ZEPETO ZEM from the purchase window.


Precautions for ZEPETO Product Test

  • When multi-server is turned on, ZEPETO Product testing is possible on the sandbox server.
  • The changes made in the editor will not be reflected in ZEPETO Studio.
  • Changes made to Pretest and released World will be reflected in ZEPETO Studio.
  • Sandbox test environment will be initialized when multi-server is turned off.(It will be initialized with ZEPETO studio data.)
  • Testing non-consumable items
    • If the multi-server is on, you cannot purchase it again once you purchase it.
    • If you turn off the multi-server, the test environment will be initialized, so if you turn on the multi-server again, you can purchase it.
  • Without registering a World Cover Image, you cannot properly perform Product testing. Please make sure to check whether the World Cover Image has been correctly registered in ZEPETO Studio.
2880

Without registering a World Cover Image, you cannot properly perform Product testing


STEP 3: Implementing Content After Purchasing the Product

Samples do not implement content after the item is used.
That part must be implemented directly as intended by the world's producers.
Please refer to the script in UICommonBtn.ts.

this._multiplay.Room.AddMessageHandler<InventorySync>("SyncInventories", (message) => {
  this.OpenInformation(`${message.productId} has been ${InventoryAction[message.inventoryAction]} in the inventory.`);
  // Item use sample
  if(message.inventoryAction == InventoryAction.Used){
    if(message.productId == "potion1"){
      console.log("potion use!");
    }
  }
});

The key is to implement the content code according to the product ID when using the product.

If you want to implement when using potion2, make the following changes:

this._multiplay.Room.AddMessageHandler<InventorySync>("SyncInventories", (message) => {
  this.OpenInformation(`${message.productId} has been ${InventoryAction[message.inventoryAction]} in the inventory.`);
  // Item use sample
  if(message.inventoryAction == InventoryAction.Used){
    if(message.productId == "potion2"){
      console.log("potion2 use!");
    }
  }
});

To communicate an economic system using ZEPETO Product with a server, server scripts and client scripts need to be implemented separately.

For script implementation, please refer to the example scripts implemented in the ZEPETO Product Sample and the ZEPETO Product API.