x


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?

more ▼

asked Dec 15 '11 at 08:37 AM

Rush3fan gravatar image

Rush3fan
293 31 43 47

(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest

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 :)

more ▼

answered Dec 15 '11 at 08:54 AM

flamy gravatar image

flamy
3.5k 5 11 37

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.

Dec 16 '11 at 12:02 AM Rush3fan

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!

Dec 16 '11 at 04:12 AM flamy

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.

Dec 16 '11 at 04:19 AM Rush3fan

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!

Dec 16 '11 at 05:23 AM flamy

Ok, thanks flamy!

Dec 16 '11 at 05:36 AM Rush3fan
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x796
x123
x45
x34
x20

asked: Dec 15 '11 at 08:37 AM

Seen: 1027 times

Last Updated: Dec 16 '11 at 05:36 AM