Skip to content

Instantly share code, notes, and snippets.

@seckincengiz
Last active December 8, 2021 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seckincengiz/8a08e2469482feb2575c5ea2e1f7b6e2 to your computer and use it in GitHub Desktop.
Save seckincengiz/8a08e2469482feb2575c5ea2e1f7b6e2 to your computer and use it in GitHub Desktop.
Command Line Arguments - Unity
using UnityEngine;
using System;
public class CLIArguments : MonoBehaviour
{
static string cliString = "";
void Start()
{
string[] arguments = Environment.GetCommandLineArgs();
foreach (string arg in arguments)
{
cliString += arg.ToString() + "\n ";
}
}
void OnGUI()
{
GUI.Label(new Rect(5, 5, 800, 500), cliString);
}
}

Windows PowerShell

.\game.exe --args -args2 arg3 arg4

Mac OS

 open game.app/ --args -args2 arg3 arg4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment