- Home /
Play Mode Unit Tests prevent game build succeeding,PlayMode Unit Tests prevent my game from building
I've started using Play Mode tests, but when I try and build my game with play mode tests disabled I get a build error about the missing NUnit dll.
Is there a way to tell Unity not to include the play mode tests in a build if play mode tests are disabled? I would prefer not to have to #if every test class, so I was just wondering if there was a better way.,I've recently added play mode unit tests, but now when I try and make a normal build for my game it fails because the NUnit assembly is not included (presumably because play mode tests are disabled).
Short of a #if guard, is there some way to tell Unity to not include these test files in my build? I don't need them, but don't want to have to add #ifs to every single play mode test class.
Answer by HaraldNielsen · Apr 08, 2018 at 06:04 PM
Hi @FuseboxAlan, There are currently no was to just disable building the tests like that. Its the reason "Enable Playmode" button in the test runner window was a warning because that will add a dependency to nunit and our own test runner assemblies. In the upcoming version of Unity you will be able to write tests in asmdefs, that will only be compiled when running tests.