Unity3d edit mode test cases hot to set platform

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?

1 answer

  • answered 2022-05-04 19:51 hijinxbassist

    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
    

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum