- Home /
Compile Scripts with Command Line
Hey Guys, I'm trying to get my head around how I can recompile my scripts using a command line. Most of the time I'm working in my IDE and I'm only opening Unity to see if the scripts are compiling without errors. Is it possible to recompile without opening Unity at all or maybe just keeping Unity minimized in the background? I read the manual about Command line arguments (https://docs.unity3d.com/Manual/CommandLineArguments.html), but couldn't find anything about compiling - just building. Greetings
Why can't you just build normally? I do that all the time in VS. Unity will build over it when you tab in, but at least it will pull up the error list as you expect.
Let's think about it. Compiling with command-line needs a command window, or at least a batch file you need to start with. Since you'd be interested in error messages, you'd be interested in the command window. With unity, that's just Alt + Tab and the errors will be right there.
So where is the benefit again?
The best would be to see the output of the Unity console in the console of my ID$$anonymous$$ It's possible to call external programs from the IDE with just command lines and with the -batchmode Argument Unity will send logs to the caller. The benefit is to not switch all the time between multiple windows and just push a shortcut inside the ID$$anonymous$$ All the time switching to Unity and back is unnecessary time wasting. A build of the game would take a huge amount of time, especially when there are no errors. I only want to see that everything is fine so why should I do a full build of it.
Answer by FlaSh-G · Sep 08, 2017 at 09:20 AM
As you know, Unity compiles scripts once it's started and focused, if it notices a change in the codebase.
Thus, it is probably enough to call it with -batchmode -quit
.
Problem is, you're booting up Unity every time you do this, adding a ****ton of unnecessary time to your compilation. Giving focus to an already opened Unity editor is probably way faster. Maybe you could do that via command line.
Good point. It's not a big problem to open the current Unity process and $$anonymous$$imize it immediately, for example with AutoHotkey, but then I also don't see the Console Output in my ID$$anonymous$$