TOLONG
FAQ Pengembangan
Cara menggunakan #if UNITY_EDITOR saat memeriksa RuntimePlatform
1mnt
saat mengembangkan, ada kalanya anda perlu memeriksa apakah skrip saat ini berjalan di unity editor atau di perangkat mobile anda dapat memeriksa apakah itu berjalan di unity editor dengan contoh kode berikut checkplatform import { zepetoscriptbehaviour } from 'zepeto script' export default class checkplatform extends zepetoscriptbehaviour { start() { // periksa apakah kode berjalan di dalam unity editor if (application iseditor) { // log pesan bahwa kode berjalan di unity editor console log("ini adalah unity editor"); } else { // jika kode tidak berjalan di unity editor, log pesan yang berbeda console log("ini bukan unity editor"); } } } 👍 tips anda dapat memeriksa berbagai lingkungan platform serta unity editor import { zepetoscriptbehaviour } from 'zepeto script' export default class checkplatform extends zepetoscriptbehaviour { start() { // periksa apakah platform aplikasi setara dengan windows editor if(application platform == runtimeplatform windowseditor) { // jika itu adalah windows editor, log pesan yang sesuai ke konsol console log("ini adalah windowseditor"); }else if (application platform == runtimeplatform osxeditor) { // jika itu adalah osx editor, log pesan yang sesuai ke konsol console log("ini adalah osx editor"); } } } untuk informasi lebih lanjut tentang runtimeplatform, silakan merujuk ke tautan berikut https //docs unity3d com/2020 3/documentation/scriptreference/runtimeplatform html https //docs unity3d com/2020 3/documentation/scriptreference/runtimeplatform html