#if UNITY_EDITOR
Debug.Log( "I'll print in Editor only.." );
#endif
我的问题是,当创建一个apk版本时,这个代码将被添加到apk版本中虽然它不会在Android上安装后运行,或者unity将不会在apk版本中包含此代码.
我期待以下其中一个回答.
>不,团结不会在APK版本中包含此代码.
>是的,统一将它包含在apk中,但它永远不会在那里运行,只会在apk中的某个地方永远无用地坐着.
P.S
The question is about including not compiling.
I Couldn’t get a clear answer elsewhere.
解决方法:
#if语句中的代码只能在指定的平台上编译.
Unity includes a feature called Platform Dependent Compilation. This
consists of some preprocessor directives that let you partition your
scripts to compile and execute a section of code exclusively for one
of the supported platforms.
https://docs.unity3d.com/Manual/PlatformDependentCompilation.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。