What I’m doing now: open scene in editor → I setup light,camera,etc. → build standalone
What I want: open scene in a program → the program setup light,camera,etc. → the program build standalone
Is there any way to support this?
What I’m doing now: open scene in editor → I setup light,camera,etc. → build standalone
What I want: open scene in a program → the program setup light,camera,etc. → the program build standalone
Is there any way to support this?
No. But you can achieve it using command line. You can execute a script in unity batch and create builds.
–
You can use it for anything that you can do in the real editor. You can execute any code using -executeMethod , from docs:
“Execute the static method as soon as Unity is started, the project is open and after the optional asset server update has been performed. This can be used to do continous integration, perform Unit Tests, make builds, prepare some data, etc.”
Here is a example that I use to update build configuration for automatic builds (extracted and not tested :P).
Command line:
"C:\Program Files (x86)\Unity\Editor\Unity.exe" -batchmode -quit -logFile "output.log" -projectPath C:/pathtoproject -executeMethod "AutoBuild.IncVersion"
Class that load ScriptableObject from resource and update it and save (automatic by dirt flag):
using UnityEngine;
using UnityEditor;
class AutoBuild
{
public static void IncVersion()
{
var buildInfo = Resources.Load<BuildInfo>("BuildInfo");
buildInfo.versionCode = buildInfo.versionCode + 1;
buildInfo.buildDate = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ");
buildInfo.version = buildInfo.majorVersion+"."+buildInfo.versionCode;
EditorUtility.SetDirty(buildInfo);
}
}
Theses links could help too: