Hi,
We’d like to test our unity scripts in our CI. We have a number of MonoBehaviour scripts that setup when Start is called and run when when Update is called.
S1) The first way to do this would be to simply add all the scripts into a scene. We would prefer not to do this as we cannot test the script individually and all the logging would be mixed.
S2) The next option would be to create a separate build with each build containing 1 scene with one of the scripts.
S3) The next option which I hope is possible but I ask about below, is to create 1 scene for each script, but include all scenes in a single build. Then when we invoke the standalone build, we can specify as an argument which scene will be used. Is this possible?
Details:
I was able to perform a standalone build from the command line with the following bat file.
set mypath=%cd%
@echo %mypath%
"C:\Program Files\Unity\Editor\Unity.exe" -quit -batchmode -logFile stdout.log -projectPath %mypath% -buildWindows64Player "builds\mygame.exe"
Q1) How does this standalone build choose which scene is included?
Q2) What files are required to exist at the projectPath specified?
I also noticed that a build can be performed with multiple scenes by using a custom build task such as
using UnityEditor;
using UnityEngine;
using System.Collections;
public class MyEditorScript: MonoBehaviour
{
static void Start()
{
string[] scenes = {"Assets/scene1.unity", "Assets/scene2.unity"};
BuildPipeline.BuildPlayer(scenes, "StandaloneWindows64", BuildTarget.StandaloneWindows64, BuildOptions.None);
}
}
Q3) How does unity choose which scene will be loaded when the standalone game is launched?
Q4) Is there a way to launch the exe and specify the scene to load via argument?
Thanks,
Justin