Studio GuideWorld SDK Guide
Log In

ScreenShot

Using the screenshot function

You can use the image related functions of ZepetoWorldContent API to save or share images within the World, and post images to feed.

ZepetoWorldContent API provides the following image related functions.

APIDescription
ZepetoWorldContent.SaveToCameraRoll(rt: UnityEngine.RenderTexture, result: System.Action$1)Saves the image to the photo library.
ZepetoWorldContent.SaveToCameraRoll(texture: UnityEngine.Texture2D, result: System.Action$1)Saves the image to the photo library.
ZepetoWorldContent.Share(rt: UnityEngine.RenderTexture, result: System.Action$1)Shares the image to an external app.
ZepetoWorldContent.Share(texture: UnityEngine.Texture2D, result: System.Action$1)Shares the image to an external app.
ZepetoWorldContent.CreateFeed(rt: UnityEngine.RenderTexture, contents: string, result: System.Action$1)Uploads the image to feed. The content of the post can be specified through the second argument, contents. World tags are automatically applied and posted to the feed.
ZepetoWorldContent.CreateFeed(texture: UnityEngine.Texture2D, contents: string, $result: System.Action$1)Uploads the image to feed. The content of the post can be specified through the second argument, contents. World tags are automatically applied and posted to the feed.

The following is an example of calling the image functions within the ZepetoWorldContent.

ZepetoWorldContent.SaveToCameraRoll(this.renderTexture, (result: boolean) => {console.log(`Save Result : ${result}`)});
ZepetoWorldContent.SaveToCameraRoll(this.texture2D, (result: boolean) => {console.log(`Save Result : ${result}`)});

ZepetoWorldContent.Share(this.renderTexture, (result: boolean) => {console.log(`Share Result : ${result}`)});
ZepetoWorldContent.Share(this.texture2D, (result: boolean) => {console.log(`Share Result : ${result}`)});

ZepetoWorldContent.CreateFeed(this.renderTexture, "[content]", (result: boolean) => {console.log(`CreateFeed Result : ${result}`)});
ZepetoWorldContent.CreateFeed(this.texture2D, "[content]", (result: boolean) => {console.log(`CreateFeed Result : ${result}`)});

The following is the example code using the functions of the screenshot mode in ZepetoWorldContent using RenderTexture.

import { Camera, RenderTexture } from 'UnityEngine';
import { Button, Text } from 'UnityEngine.UI';
import { SpawnInfo, ZepetoPlayers } from 'ZEPETO.Character.Controller';
import { ZepetoScriptBehaviour } from 'ZEPETO.Script';
import { WorldService, ZepetoWorldContent } from 'ZEPETO.World';

export default class ZepetoWorldContentExample extends ZepetoScriptBehaviour {

    // ZepetoWorldContent ScreenShot UI
    public cameraRenderButton: Button;
    public saveToCameraRollButton: Button;
    public shareButton: Button;
    public createFeedButton: Button;
    public logText: Text;

    // Render Camera
    private camera: Camera;

    // Render Texture
    public renderTexture: RenderTexture;

    Start() {
        ZepetoPlayers.instance.CreatePlayerWithUserId(WorldService.userId, new SpawnInfo(), true);
        ZepetoPlayers.instance.OnAddedLocalPlayer.AddListener(() => {
            this.camera = ZepetoPlayers.instance.LocalPlayer.zepetoCamera.camera;
        });

        this.cameraRenderButton.onClick.AddListener(() => {
            this.camera.targetTexture = this.renderTexture;
            this.camera.Render();
            this.camera.targetTexture = null;
        });

        this.saveToCameraRollButton.onClick.AddListener(() => {
            ZepetoWorldContent.SaveToCameraRoll(this.renderTexture, (result: boolean) => {
                this.logText.text = `Save Result : ${result}`;
            });
        });

        this.shareButton.onClick.AddListener(() => {
            ZepetoWorldContent.Share(this.renderTexture, (result: boolean) => {
                this.logText.text = `Share Result : ${result}`;
            });
        });

        this.createFeedButton.onClick.AddListener(() => {
            ZepetoWorldContent.CreateFeed(this.renderTexture, "[CONTENT]", (result: boolean) => {
                this.logText.text = `CreateFeed Result : ${result}`;
            });
        });
    }
}

❗️

Caution

  • It cannot be checked in the Unity editor mode, but can be checked when playing on the app.

Screenshot Sample

The example project is available for download from Github.

📘

Official ScreenShot Sample

👍

Screenshot Sample Description

  • This is a ScreenShot example project using image-related functions of the ZepetoWorldContent API.
  • ZEPETO login must be proceeded before you can run the project.
  • It consists of selfie mode and ZepetoCamera mode, saving or sharing images via RenderTexture, and using images to create feeds.


Guidelines for application to existing projects

When applying to existing projects, we recommend that you follow the guidelines below.

  • Zepeto.World version must be 1.21.14 or higher.

    • You can use ZepetoWorldContent function normally when proceeded within 1.21.14 or higher versions of the World. Version update available at Window - PackageManager - Zepeto.World
  • Layer 21 in the sample project is designated as Player.

    • If you are using custom layer 21 when applying to an existing project, please modify the value of playerLayer in ZepetoScreenShotModule.ts.
330
  • ZepetoPlayers must be in Scene.

    • Player generation code must be written separately.
    • Please refer to the PlayerCreator.ts file in the project.
  • You must insert ZepetoScreenShotModule into Scene.

347
  • Animator that IKPass activated must be used.
632

👍

IKPass

  • When using an existing ZepetoAnimator

    • Drag the ZepetoAnimator file from ZepetoPlayers to the Assets/... path in the local environment and copy the corresponding asset.
    • Activate the IKPass of the copied ZepetoAnimator,
      and replace the Animator Controller of the ZepetoPlayers with the corresponding animator.
  • When using Custom Animator

    • Activate the IKPass of the currently used Animator.

  • The rotation direction is supported based on the Horizontal.
    • Set as Orientation - Horizontal in ZepetoWorldSetting.
593
  • Regarding camera settings
    • Camera settings in ZepetoCamera mode modify the settings of ZepetoPlayers - Camera.
508
  • The camera settings in selfie camera mode change the setting values of Selfie Camera.ts in Resources - Selfie Camera prefab.
505