I’m running Unity on Windows 10 and want to make sure my tests are restricted to run on RuntimePlatform.WSAPlayerARM
, RuntimePlatform.WSAPlayerX64
, or RuntimePlatform.WSAPlayerARM
, so I’ve used the UnityPlatform
attribute to specify this. The test relies on code which is only compiled on Windows 10, and not for the editor; that is, it’s surrounded by #ifdef UNITY_WSA_10_0 && !UNITY_EDITOR
… #endif
. When I run the test, it claims that a certain object reference is not set ( NullReferenceException
) because Application.platform
is WindowsEditor
, meaning that UNITY_EDITOR
is true and that code isn’t being compiled, at least for my tests.
I had to remove my UnityPlatform
attribute to get my tests (which are in PlayMode) to run, because when I ran them from the test runner, the test just said that the test was only supported on those certain platforms. I don’t understand how I can get these tests to run, because I’m ostensibly on a platform (Windows 10) which can run the platforms I’ve specified.
Is there something I’m missing? Am I specifying the wrong RuntimePlatforms? Any help would be greatly appreciated.