创造你的世界
记录
截图
13 分
使用截图功能 您可以使用zepetoworldcontent api的图像相关功能在世界中保存或分享图像,并将图像发布到动态中。 zepetoworldcontent api提供以下图像相关功能。 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type 以下是调用 zepetoworldcontent 中图像功能的示例。 zepetoworldcontent savetocameraroll(this rendertexture, (result boolean) => {console log(`保存结果 ${result}`)}); zepetoworldcontent savetocameraroll(this texture2d, (result boolean) => {console log(`保存结果 ${result}`)}); zepetoworldcontent share(this rendertexture, (result boolean) => {console log(`分享结果 ${result}`)}); zepetoworldcontent share(this texture2d, (result boolean) => {console log(`分享结果 ${result}`)}); zepetoworldcontent createfeed(this rendertexture, "\[内容]", (result boolean) => {console log(`创建动态结果 ${result}`)}); zepetoworldcontent createfeed(this texture2d, "\[内容]", (result boolean) => {console log(`创建动态结果 ${result}`)}); 以下是使用 zepetoworldcontent 中截图模式功能的示例代码,使用 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 截图 ui public camerarenderbutton button; public savetocamerarollbutton button; public sharebutton button; public createfeedbutton button; public logtext text; // 渲染相机 private camera camera; // 渲染纹理 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 = `保存结果 ${result}`; }); }); this sharebutton onclick addlistener(() => { zepetoworldcontent share(this rendertexture, (result boolean) => { this logtext text = `分享结果 ${result}`; }); }); this createfeedbutton onclick addlistener(() => { zepetoworldcontent createfeed(this rendertexture, "\[内容]", (result boolean) => { this logtext text = `创建动态结果 ${result}`; }); }); } } 无法在unity编辑器模式下检查,但可以在应用程序运行时检查。 截图 截图模块包含在buildit unity plug in中,可以在下面的github中查看模块脚本。 📘 build it unity plug in 截图模块 https //github com/zepeto techevangelist/zepeto buildit template/tree/main/assets/buildittemplate/modules/screenshot 截图功能的使用方法 截图功能可通过点击位于buildit unity plug in world play画面右侧的相机图标来使用。 1:自拍模式按钮 可将相机切换为自拍模式。 2: 拍照按钮 我们可以拍摄播放画面。 3:视频录制按钮 我们可以录制播放画面。 4:退出按钮 你可以退出截图模式。 ✏️ 笔记本 聊天对话框无法拍摄,请参考。 摄影 点击拍照按钮,会出现上述弹窗。 按下 upload 按钮,拍摄的照片就会立即上传到我的zepeto帖子中。 照片与截图prefab中设置的基本description文本一起上传到种子中。 如何更改默认文本请参阅 docid\ q9lrtxllryvexdza kqap 指南。 点击 edit 按钮可以在上传截图到种子之前修改帖子文本。 1 共享按钮 我们可以分享截图。 2 下载按钮 你可以把截图保存到我的机器里。 3 退出按钮 你可以退出edit模式。 4 照片预览窗口 可以预览拍摄的截图。 5 修改后文本 你可以结合截图修改要上传到zepeto种子上的文本。 6 上传按钮 你可以把截图和文本上传到zepeto种子。 视频录像 点击视频录制按钮即可开始录制,并显示录制时间。 自拍模式 点击截图图标后,会出现自拍模式图标。 点击该图标即可启用自拍模式。 在自拍模式下,角色会看向镜头。如果相机移动超过一定角度,角色会重新面向正前方。 在自拍模式激活状态下,您可以拍照或录制视频。 再次点击自拍模式图标可退出该模式,退出截图功能时自拍模式也会一并关闭。 如何更改截图 description 文本 通过弹窗的 upload 按钮上传帖子,截图将与基本文本" #zepeto world #zepeto #bildy #world "一起上传。 按下 edit 按钮时出现的 description 盒中的文本也是基本文本"#zepeto world #zepeto #bildy #world"。 如何更改默认的description文本如下。 在左侧 hierarchy 窗口中选择 managers > screenshot 。 在右侧的 inspector 窗口中,按下prefab区域下面的 open 按钮,打开screenshot prefab。 在左侧 hierarchy 窗口中选择 screenshot > safearea > screenshot > previewpanel > previewtextfieldpanel > previewinputfield 。 在右侧的 inspector 窗口中查找 text 字段,并将其更改为所需的文本。 通过如下示例更改文本,可以检查 description 盒中的文本已被更改。 看不到截图图标时 如上所述,在播放画面右侧看不到截图图标时,解决方法如下。 在左侧 hierarchy 窗口中选择 managers > screenshot 。 在右侧的 inspector 窗口中检查左侧的复选框。
