Search Unity

Add GameObject to current scene using EditMode test.

Discussion in 'Testing & Automation' started by jpvanoosten, Jan 21, 2022.

  1. jpvanoosten

    jpvanoosten

    Joined:
    Nov 20, 2009
    Posts:
    50
    I'm sorry if this question was already asked elsewhere, but I'm trying to add a procedurally generated mesh to the current scene using an edit mode test.

    When I run the test, it seems that a temporary scene (called "Untitled") is created for the test, the mesh gets added to the temporary scene, but as soon as the test finishes, the scene is removed from the editor (along with the mesh I want to observe).

    How can I add the procedurally generated mesh to the current scene so that I can view it after the test is finished running?
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    All tests are launched into a temporary autogenerated scene.
    In your test code however, you can do whatever you like - for example - load any scene, the generate whatever objects you need.