Unity3D编辑模式测试用例热门设置平台

发布于 2025-01-26 01:54:45 字数 357 浏览 3 评论 0原文

我有以下代码

#if UNITY_IOS && !UNITY_EDITOR
    public static MyPlugin Current = new MyPluginIOS();
#elif UNITY_ANDROID && !UNITY_EDITOR
    public static MyPlugin Current = new MyPluginAndroid();
#else
    public static MyPlugin Current = new MyPluginEditor();
#endif

编写测试案例,并希望将平台选择为unity_android,该如何做到这一点?

I have following code

#if UNITY_IOS && !UNITY_EDITOR
    public static MyPlugin Current = new MyPluginIOS();
#elif UNITY_ANDROID && !UNITY_EDITOR
    public static MyPlugin Current = new MyPluginAndroid();
#else
    public static MyPlugin Current = new MyPluginEditor();
#endif

I am writing test case and want to select platform As UNITY_ANDROID how can I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

和影子一齐双人舞 2025-02-02 01:54:45

您可以使用以下行来定义Unity_android预处理程序指令。

#define UNITY_ADROID

从文档中找到在这里

#define允许您定义一个符号。通过将符号用作传递给#if指令的表达式,表达式评估为true。

如果您需要删除/不确定该预处理器指令,则可以使用

#undef UNITY_ANDROID

You can use the following line to define the UNITY_ANDROID preprocessor directive.

#define UNITY_ADROID

From the Docs found Here

#define lets you define a symbol. By using the symbol as the expression passed to the #if directive, the expression evaluates to true.

If you need to remove/undefine that preprocessor directive, you can use

#undef UNITY_ANDROID
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文