UWP doesn't compile if Play Test Mode Enabled

I discovered that if "ProjectSettings.asset" file contains parameter "playModeTestRunnerEnabled: 1" (Play Test Mode is Enabled), then UWP project does not compile, because of compilation errors that are related to Test Runner assembly.

This is a known issue with .NET scripting backend. It does not manifest if you’re using IL2CPP. We have people working on fixing that.

Thank you Tautvydas-Zilys for quick reply.
We are generating VS2017 project\solution (need to configure some UWP params and to change some generated code). We are not building package directly in unity.
We will be very happy if you will give us some estimation for this problem fix.

The problem still exists in Unity 2017 LTS. Is there any fix by now or will I have to edit the file manually? It makes automatic build & test servers pretty difficult to handle as they need to have the testrunner active but also need to be able to build UWP

I’m having this issue (two years later) on 2019.3.0f3 right now.

The API it’s internal so I created a snippet that disables it via reflection:

public static void DisablePlayModeTestsForAllAssemblies() {
        Assembly unityEditorAssembly = AppDomain.CurrentDomain
            .FirstOrDefault(e => e.GetName().Name.Equals("UnityEditor"));

        Type playerSettingsType = unityEditorAssembly.GetType("UnityEditor.PlayerSettings");

        PropertyInfo playModeTestRunnerEnabledProperty = playerSettingsType.GetProperty("playModeTestRunnerEnabled", BindingFlags.Static | BindingFlags.NonPublic);
        playModeTestRunnerEnabledProperty.SetValue(false, null);

@Tautvydas-Zilys any news?

My problem is that I’m using batch mode with Test Runner and Code Coverage packages and they seem to enable automatically this value and later if I make another build for UWP it will fail because of this value set to true.

This seems like a totally separate issue. The original issue only affected .NET scripting backend and that doesn’t exist in 2019.3 anymore. Can you report a bug on this?

It is really easy to reproduce.

Here you have: Case 1208398

Thanks, we’ll take a look.

We are facing the same issue in 2019.4.0f1. Setting "playModeTestRunnerEnabled: 0" in "ProjectSettings.asset" solves the problem for now. Any news on a real solution? I cannot see the Case above...

How is this going @Tautvydas-Zilys ? It's been three years since the thread was opened and more than half a year since I reported the bug...

Still active...


Bump @Tautvydas-Zilys … How is this going?

Almost one year since the bug report.

I pinged the team responsible for this area. Sorry for the lack of progress.