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.21.14 or later version first.
After that, please install the ZEPETO.Module package.
STEP 2 : UI > Adding an Image
- We need to add an Image component to the Scene that will display the thumbnails. Please add Hierarchy > UI > Raw Image.
- Set the Width and Height to the same Size.
STEP 3 : Write the script
- Create a Hierarchy > Create Empty Object and rename it to DownloadThumbnail
- create Project > Create > ZEPETO > TypeScript and rename it to DownloadThumbnailSample.
- Write the sample script as shown below.
import { ZepetoScriptBehaviour } from 'ZEPETO.Script';
import { ShopService } from 'ZEPETO.Module.Shop';
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;
}
}
}
- After you finish writing the script, add the DownloadThumbnailSample script to the DownloadThumbnail object.
- Assign image to the script inspector and enter the itemCode.
Please refer to the mannequin guide on how to check the itemCode. [ZEPETO Mannequin]
- Press the [▶︎(play)] button to execute, and you should see the item thumbnail in the image you set.