- Home /
Can a Unity Stand-Alone EXE run as a service?
Is it possible to run a Unity stand alone as a windows service? My requirement is that the application is restarted if it crashes, and also as I need to run it on a Windows Server, it would be convenient to run it as a service so that it keeps running regardless of a session being opened.
I would advise to write a separate helper service, which checks if the main (Unity) program is still running. Your service could then restart the main program if needed.
Answer by Perillio · 6 days ago
For those still in need of the solution:
open up a command prompt as admin
type: SC CREATE "Name of the Service" binpath= "X:\Folder\filename.exe"
be happy with your new service
Cheers
Note: when you want to pass commandline arguments, have a look at this SO question. Specifically you have to quote the actual path seperately from the arguments. At least this is necessary if your path contains spaces
SC CREATE nameOfService binpath= "\"X:\Folder\filename.exe\" -nographics -batchmode -nolog"
Answer by unisip · Nov 18, 2012 at 10:39 AM
Agreed. In fact i ve done that already a d it works just fine. Making the unity app a service itself would improve the solution by enabling it to run without a windows session or in a locked session, which is better from a security standpoint
hey unisip i am looking for same thing...i wanted to create unity standalone app as a service which run on windows server in background. my client app will send request to this service, and this service will serve client's request.
could you please guide me or provide some reference how you achieve it?
thanks in advance