Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Application.isPlaying on Unit Tests

Discussion in 'Testing & Automation' started by Darkgaze, Jun 9, 2021.

  1. Darkgaze

    Darkgaze

    Joined:
    Apr 3, 2017
    Posts:
    381
    I'm working on some basic editor [Test]. I create a gameobject and do some stuff with it.

    One of the components I add contains several arrays that are not created when initialized unless we are in Play Mode using if (Application.isPlaying).

    How can I test this using Unit Testing? I wonder if this should be done by using Runtime Tests [UnityTest] or similar, or there is a way to "fake" the play mode. There's no real need for runtime really.