- Home /
Is there any Unity API/Lib I can use in my program?
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?
Answer by Sisso · Mar 22, 2015 at 01:21 AM
No. But you can achieve it using command line. You can execute a script in unity batch and create builds.
http://docs.unity3d.com/Manual/CommandLineArguments.html
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:
Thanks! Is this cmd line only for builds or I can use it to modify my scene? If it can modify the scene, where can I find related documents? A keyword or class name is enough so I can search myself.
Your answer

Follow this Question
Related Questions
beginner syntax error 2 Answers
unity uninstalling/deleting itself. 2 Answers
Is there a way I can make textures? 2 Answers
When I install the program I need to change any settings? 0 Answers
Can I make a 64-bit game in Unity? 3 Answers