- Home /
Monobehaviour.Start() is called when Playmode tests are executed
TL;DR; Set up Unity TestRunner, EditMode works Fine, PlayMode tests are screwed over by unwanted Start() methods which are called when tests are executed.
Hi, I'm integrating the Unity TestRunner into my game, and got it set up. I already wrote an EditMode test and it works fine. Now I'm implementing PlayMode tests and noticed something weird.
When I execute PlayMode tests, the Monobehaviour Start() method is called, executing a bunch of unwanted code. Is this supposed to happen? Is there a way to prevent it? I'm using Unity 2019.2.11f
Comment
Right now I solved this by adding a static class with a static bool "IsTest", which Start() checks for and tests set. Works, but doesn't feel right!