I need to create different builds of the project I’m working on.
My builds differs one from the other from some scenes. So I need to change them for each build.
The point is that I woud like to test some workflows of my project with the different builds settings. I’ve tryed something like this:
using NUnit.Framework;
using UnityEditor;
namespace Tests
{
public class TestRunner
{
private string oldScenePath;
[SetUp]
public override void Setup()
{
EditorBuildSettingsScene[] newScenes = EditorBuildSettings.scenes;
oldScenePath = newScenes[3].path;
newScenes[3].path = "scene/to/change.unity";
EditorBuildSettings.scenes = newScenes;
}
[TearDown]
public override void Teardown()
{
EditorBuildSettingsScene[] newScenes = EditorBuildSettings.scenes;
newScenes[3].path = oldScenePath;
EditorBuildSettings.scenes = newScenes;
}
[UnityTest]
public override string Test()
{
//Make things
}
}
}
But this does not work, because SetUp is run during running mode, where I can not modify the EditorBuildSettings.
Any advice? Is it possible to make run a script before Unity enters in Play mode before running all the tests?