GuidesAPI Reference
Log In

Item Icon Thumbnail Download API

The ZEPETO.Module package allows you to download thumbnail textures for ZEPETO items.

By dynamically downloading item thumbnails, you can help reduce the size of your Build Package.


STEP 1 : Installing

Please install Window → Package Manager → ZEPETO.World Package 1.16.0 or later version first.

After that, please install the ZEPETO.Module package.


STEP 2 : UI > Adding an Image

  1. We need to add an Image component to the Scene that will display the thumbnails. Please add Hierarchy > UI > Raw Image.
  2. Set the Width and Height to the same Size.

STEP 3 : Write the script

  1. Create a Hierarchy > Create Empty Object and rename it to DownloadThumbnail
  2. create Project > Create > ZEPETO > TypeScript and rename it to DownloadThumbnailSample.
  3. Write the sample script as shown below.
import { ZepetoScriptBehaviour } from 'ZEPETO.Script';
import { ShopService } from 'ZEPETO.Module.Shop';
import { TextureRequest } from 'ZEPETO.Module';
import * as UnityEngine from 'UnityEngine';
import { RawImage } from 'UnityEngine.UI';
 
export default class DownloadThumbnailSample extends ZepetoScriptBehaviour {
 
    public image : RawImage;
    public itemCode : string;
     
    Start() {
        this.StartCoroutine(this.DownloadItemTexture());
    }
     
    *DownloadItemTexture()
    {
        // Download thumbnail texture for the specified item code
        var request = ShopService.DownloadItemThumbnail(this.itemCode);
         
        yield new UnityEngine.WaitUntil(()=>request.keepWaiting == false);
         
        if(request.responseData.isSuccess)
        {
            this.image.texture = request.responseData.texture;
        }
    }
 
}

  1. After you finish writing the script, add the DownloadThumbnailSample script to the DownloadThumbnail object.
  2. Assign image to the script inspector and enter the itemCode.

📘

Please refer to the mannequin guide on how to check the itemCode. [ZEPETO Mannequin]

  1. Press the Play button to execute, and you should see the item thumbnail in the image you set.