- Home /
Is it possible to execute a Unity game using a command line?
I want a different program to execute my game with a command line that contains various parameters such as the level number. Is that possible with a Unity exe?
Answer by flamy · Dec 15, 2011 at 08:54 AM
It is possible to run unity with some predefined command lines for more info look at this page. if u are passing ur custom command lines like level u should be able to read them through the following function,
System.Environment.GetCommandLineArgs()
but i doubt if it will help u!!... What are u planning to do exatly?! if u want to start the game with the level progress (like saving game data and loading on startup), you can use a loading screen that loads the saved level number from last time using Playerprefs class. If it is for testing purpose have a menu in the loading screen(simple gui buttons) to skip to the level u want!!
Anyway i think it was helpful :)
Edit: I know it is old, but sorry! this cannot be done for custom arguments!
I can't tell you exactly what I'm doing, but all I can say is that is great news. It was either going to be that, or a .txt file that contains the parameters.
Well, thank you. That was very helpful as I tried typing "CommandLine" in the script reference search and nothing came up.
oh if u r a c# user try searching in msdn first and then chk if it is compatible with mono(Unity) :D that is how i do always :D
This is the list of all c# functions and classes supported in unity!
I try to put everything in javascript. I like C++, but C# is hard to learn and javascript seems to be more popular in Unity.
even is started with js and thought it would be enough for ever! but ya all depends on one's personal preference, no probs with using js (Except if u want to use native plugins!)
also the list i have given above is not restricted only to c# u can use them in js aslo, u have to use import ; to access it in ur code and use it the same way as c# users do!
Your answer
Follow this Question
Related Questions
Command line iOS builds taking ages due to PVRTC 0 Answers
Opening a EXE file from a Unity game 1 Answer
Particle system and line renderer doesn't work in Maximized Window 1 Answer
getting udp package info inside unity (GlovePIE) 0 Answers
I can`t open .exe file after building the game for Windows 64 bit 1 Answer