- Home /
How to tell if the game is running in batchmode?
Is there a way to tell if the game it running in batch mode? What I want do is if the game is running in batchmode, then start the game as a server. If it is not running in batchmode, then let the game connect to a server. Is this possible with only having one project executable or do I need to (should) create I project as the server and one as the client?
Answer by Ryan Zec · Apr 13, 2011 at 12:24 PM
With help from the forums, doing SystemInfo.graphicsDeviceID == 0 will be true in batch mode/headless mode.
Answer by Kourosh · Apr 13, 2011 at 01:40 AM
By batching you mean clients? It is possible to have one project. You need have networkview for objects that need to be synchronized over net, and Use RPC to execute functions over the network.
Check this link: http://unity3d.com/support/documentation/ScriptReference/Network-isServer.html
What I mean by batchmode is that the game is running headlessmode with no GUI. The issue I am having is not how to tell if the game is a server of client but how to tell weather or not to automatically start the game as a server. I want to be able to start the game as a server automatically if the game is running in batchmode/headlessmode and if not, allow the game to connect to a server as a client.
sorry about the tag that confused you, I meant to add the batchmode tag, not batching.
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
running servers for networked games 0 Answers
Console Application 0 Answers
Reducing server-side application size 0 Answers
Headless linux server 2 Answers