Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by JBC · Jun 14, 2010 at 06:47 PM · logcommand

Command line feedback

I am running a Unity Editor function from the commandline and I am looking to get feedback to the console/terminal instead of only the "Editor.Log" file. Basically anything that comes out of the Debug.log would be great, especially to see where things are failing.

I've tried the C# "System" but it seems to conflict with another Unity object.

Any suggestions? TIA.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

4 Replies

· Add your reply
  • Sort: 
avatar image
6

Answer by pronebrid · Feb 19, 2013 at 07:37 PM

Empty -logFile option forces Unity to output log to console:

$UNITY_BIN -quit -batchmode -logFile -projectPath ...

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image softrare · Oct 24, 2013 at 03:07 PM 0
Share

What does -quit do?

avatar image semiessessi · Nov 13, 2013 at 05:43 PM 2
Share

this is no longer true, if it ever was.

avatar image Jared-Mess · Nov 21, 2013 at 10:15 PM 2
Share

This WILL work for people using OSX (I'm on Unity 4.2 using $$anonymous$$avericks). Does NOT work for Windows users (At least not on Windows 7).

avatar image Lohoris2 · Mar 14, 2014 at 11:53 AM 1
Share

Works on linux too

avatar image
2

Answer by capyvara · Aug 13, 2011 at 04:06 AM

This is what I've done as a workaround:

On Unix based system (such as OSX) you can create a shell script to monitor the Editor.log and output to the stdout, ex:

unity_stdout.sh

 #!/bin/sh
 tail -F ~/Library/Logs/Unity/Editor.log &
 /Applications/Unity/Unity.app/Contents/MacOS/Unity "$@"
 EXITCODE="$?"
 kill %1
 exit "$EXITCODE"

Usage:

 ./unity_stdout.sh -batchMode ...etc

It launches tail in monitor mode as a background task, launches Unity passing the command line arguments, store it's exit code, kills tail and return the saved exit code.

However all the Editor.log will be dumped, this include calls to Debug.Log() and Console.WriteLine().

If you want to choose what will be dumped to the console, instead open a file stream in Unity to some file like My.log, write to it and modify the shell script to monitor your file instead of the Unity.log

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image hello1111 · Nov 07, 2014 at 12:32 AM 0
Share

nice. ~/Library/Logs/Unity/Editor.log is exactly what i was looking for.

avatar image
-1

Answer by JBC · Jun 17, 2010 at 11:50 PM

actually Joachim Ante had a great answer that works from another answer:

string[] System.Environment.GetCommandLineArgs()

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image semiessessi · Nov 13, 2013 at 05:43 PM 3
Share

i can not imagine how this is relevant to the question at all.

avatar image Lohoris2 · Mar 14, 2014 at 11:54 AM 1
Share

@semiessessi I can easily imagine how he just didn't bother to actually read the question and gave a random answer

avatar image Lohoris2 · Mar 14, 2014 at 11:56 AM 0
Share

However I just noticed that he is actually the OP! So he didn't, umh, read his own question? This site is insane.

avatar image semiessessi · Mar 14, 2014 at 11:57 AM 0
Share

no. people are insane. the site simply is... :)

avatar image Lohoris2 · Mar 14, 2014 at 12:37 PM 0
Share

Well, compared with the SE network, this is an unmoderated mess. Community-driven sites do not work if the community isn't large enough for the design, and this desing implies needs many dedicated users that just aren't there.

avatar image
0

Answer by Mike 3 · Jun 14, 2010 at 07:03 PM

try

System.Console.WriteLine(yourString)

if that doesn't work, you'll have to reroute the standard console output (only need to do it once):

System.IO.StreamWriter standardOutput = new System.IO.StreamWriter(System.Console.OpenStandardOutput());
standardOutput.AutoFlush = true;
System.Console.SetOut(standardOutput);

Then you can use System.Console.WriteLine(yourString);

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image JBC · Jun 15, 2010 at 12:15 AM 0
Share

this does not appear to be working for me. (windows btw) A good example of this is being used would be the DressingRoom example project where the commandline is: unity.exe -batchmode -quit -nographics -projectPath "C:\demo\characterdemo\unity" -execute$$anonymous$$ethod CreateAssetbundles.Execute but the gameObject is coded into the CS file.

avatar image Mike 3 · Jun 15, 2010 at 09:29 AM 0
Share

In that case, not sure if there is a way to do it - it sounds like they've rerouted the standard out for mono, so no way to get at the console stream.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Capturing log messages 3 Answers

what is the output log in the game data 1 Answer

Trace error with line number in device platform 0 Answers

How to redirect System.Console.Write from dll to Debug.Log 1 Answer

Redirect log to console / don't rewrite log file 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges