HELP
Development FAQ

How to use #if UNITY_EDITOR when checking RuntimePlatform

1min
while developing, there are times when you need to check whether the current script is running in the unity editor or mobile you can check whether it is running in the unity editor with the following example code checkplatform import { zepetoscriptbehaviour } from 'zepeto script' export default class checkplatform extends zepetoscriptbehaviour { start() { // check if the code is running inside the unity editor if (application iseditor) { // log a message that the code is running in the unity editor console log("this is unity editor"); } else { // if the code is not running in the unity editor, log a different message console log("it's not the unity editor"); } } } 👍 tips you can check various platform environments as well as the unity editor import { zepetoscriptbehaviour } from 'zepeto script' export default class checkplatform extends zepetoscriptbehaviour { start() { // check if the application's platform is equivalent to the windows editor if(application platform == runtimeplatform windowseditor) { // if it's the windows editor, log the corresponding message to the console console log("this is windowseditor"); }else if (application platform == runtimeplatform osxeditor) { // if it's the osx editor, log the corresponding message to the console console log("this is osx editor"); } } } for more information about runtimeplatform, please refer to the following link https //docs unity3d com/2020 3/documentation/scriptreference/runtimeplatform html https //docs unity3d com/2020 3/documentation/scriptreference/runtimeplatform html