あなたの世界を作りなさい
ポータル
異世界移動API
2分
レビューを通過し、アクティブ化されたワールド間でのみ移動できます。 ターゲットワールドの秘密の部屋には入れません。 zepetoworldcontentをインポートする必要があります。これにより、ワールド間の移動apiを使用できます。 import { zepetoworldcontent } from 'zepeto world'; 関数の定義は次のとおりです: api 説明 public static movetoworld($worldid string, $onerror system action$2\<number, string>)\ void; world id テキストがパラメータとして設定された後、関数が呼び出されると、ワールド間の移動が実行されます。 \ 移動できないワールドの場合、エラーが発生し、エラー時にコールバックを通じて制御できます。 以下は、特定の gameobject トリガーに入ると別のワールドに移動するコードサンプルです。 movetoworld import { zepetoscriptbehaviour } from 'zepeto script'; import { zepetoworldcontent } from 'zepeto world'; import { collider,vector3,quaternion } from 'unityengine'; import { zepetocharacter, zepetoplayer, zepetoplayers } from 'zepeto character controller'; export default class movetoworld extends zepetoscriptbehaviour { private zepetocharacter zepetocharacter; // 例 com default jumpworld private worldid string = "world id"; start() { zepetoplayers instance onaddedlocalplayer addlistener(() => { this zepetocharacter = zepetoplayers instance localplayer zepetoplayer character; }); } ontriggerenter(collider collider) { if ((this zepetocharacter == null) || (collider gameobject != this zepetocharacter gameobject)) { return; } zepetoworldcontent movetoworld(this worldid, (errcode, errmsg) => { // エラーコールバック処理の例 // (実装時には、ポップアップウィンドウなど、さまざまな方法で実装してみてください) console log(`${errcode} ${errmsg}`); }); } }