Question by
krisstoffen · Oct 19, 2016 at 09:19 PM ·
applicationquitreturn value
Can a Unity Application return an error code?
Dear Unity experts,
In C# Console Applications it is possible to let the main function return an int value. For example, on success the program could return 0, on failure the program could return 1. When started in a windows command window, the return value is available with:
echo %errorlevel%
My question is, whether it is possible to return an exit code when I quit a Unity application. For example, I want to send with the returned errorlevel whether the game was won or lost.
Comment
Untested:
using System;
//
Environment.ExitCode = -2;
https://msdn.microsoft.com/en-us/library/system.environment.exitcode(v=vs.110).aspx
Thank you @doublemax for your suggestion. Unfortunately this doesn't work. I have found another thread that states the disappointing message that it is not possible in Unity to set exit codes: