├── .gitignore ├── Assets ├── Batch.meta ├── Batch │ ├── Test.bat │ └── Test.bat.meta ├── Editor.meta ├── Editor │ ├── Main.cs │ └── Main.cs.meta ├── Scripts.meta └── Scripts │ ├── Com.meta │ └── Com │ ├── EpixCode.meta │ └── EpixCode │ ├── Util.meta │ └── Util │ ├── CommandLineReader.cs │ └── CommandLineReader.cs.meta └── ProjectSettings ├── AudioManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── InputManager.asset ├── NavMeshLayers.asset ├── NetworkManager.asset ├── ProjectSettings.asset ├── QualitySettings.asset ├── TagManager.asset └── TimeManager.asset /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | Library 3 | Temp 4 | *.csproj 5 | *.pidb 6 | *.unityproj 7 | *.sln 8 | *.userprefs -------------------------------------------------------------------------------- /Assets/Batch.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b923349fe93f63b4ea9f998e9d78eb40 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Batch/Test.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | ::Variables definition 4 | SET ProjectLocation=%cd%\..\.. 5 | SET UnityLocation="C:\Program Files (x86)\Unity\Editor\Unity.exe" 6 | 7 | ::Execution 8 | %UnityLocation% -batchmode -projectPath %ProjectLocation% -logFile %cd%\log.txt -executeMethod Main.EntryPoint -quit -CustomArgs:Language=en_US;Version=1.02 9 | 10 | pause -------------------------------------------------------------------------------- /Assets/Batch/Test.bat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1bf4d5282f9538b419792412b005d9a1 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d60fcc7459579df4c80f4c2a1d1ff9bb 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Editor/Main.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System; 4 | using System.Linq; 5 | 6 | class Main 7 | { 8 | public static void EntryPoint() 9 | { 10 | Debug.Log("Language ->" + CommandLineReader.GetCustomArgument("Language")); 11 | Debug.Log("Version ->" + CommandLineReader.GetCustomArgument("Version")); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Assets/Editor/Main.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a3cabb227f4d20344ba31264ce9e9463 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f77df37255d052a4e95fd4fbba37fcaa 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Scripts/Com.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d667e9bd82c24834abdcd1c83918850d 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Scripts/Com/EpixCode.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8357744b167bab743b7869731f6308a9 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Scripts/Com/EpixCode/Util.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6d3a2a4177012cd46977279690fee2e4 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Scripts/Com/EpixCode/Util/CommandLineReader.cs: -------------------------------------------------------------------------------- 1 | #region Author 2 | /************************************************************************************************************ 3 | Author: EpixCode (Keven Poulin) 4 | Website: http://www.EpixCode.com 5 | GitHub: https://github.com/EpixCode 6 | Twitter: https://twitter.com/EpixCode (@EpixCode) 7 | LinkedIn: http://www.linkedin.com/in/kevenpoulin 8 | ************************************************************************************************************/ 9 | #endregion 10 | 11 | #region Copyright 12 | /************************************************************************************************************ 13 | Copyright (C) 2013 EpixCode 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 16 | and associated documentation files (the "Software"), to deal in the Software without restriction, 17 | including without limitation the rights to use, copy, modify, merge, publish, distribute, 18 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished 19 | to do so, subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice shall be included in all copies or substantial 22 | portions of the Software. 23 | 24 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 25 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 27 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 29 | ************************************************************************************************************/ 30 | #endregion 31 | 32 | #region Class Documentation 33 | /************************************************************************************************************ 34 | Class Name: CommandLineReader.cs 35 | Namespace: Com.EpixCode.Util 36 | Type: Util, Static 37 | Definition: 38 | CommandLineReader.cs give the ability to access [Custom Arguments] sent 39 | through the command line. Simply add your custom arguments under the 40 | keyword '-CustomArgs:' and seperate them by ';'. 41 | Example: 42 | C:\Program Files (x86)\Unity\Editor\Unity.exe [ProjectLocation] -executeMethod [Your entrypoint] -quit -CustomArgs:Language=en_US;Version=1.02 43 | 44 | ************************************************************************************************************/ 45 | #endregion 46 | 47 | #region Using 48 | using System; 49 | using System.Collections.Generic; 50 | using System.Linq; 51 | using UnityEngine; 52 | #endregion 53 | 54 | public class CommandLineReader 55 | { 56 | //Config 57 | private const string CUSTOM_ARGS_PREFIX = "-CustomArgs:"; 58 | private const char CUSTOM_ARGS_SEPARATOR = ';'; 59 | 60 | public static string[] GetCommandLineArgs() 61 | { 62 | return Environment.GetCommandLineArgs(); 63 | } 64 | 65 | public static string GetCommandLine() 66 | { 67 | string[] args = GetCommandLineArgs(); 68 | 69 | if (args.Length > 0) 70 | { 71 | return string.Join(" ", args); 72 | } 73 | else 74 | { 75 | Debug.LogError("CommandLineReader.cs - GetCommandLine() - Can't find any command line arguments!"); 76 | return ""; 77 | } 78 | } 79 | 80 | public static Dictionary GetCustomArguments() 81 | { 82 | Dictionary customArgsDict = new Dictionary(); 83 | string[] commandLineArgs = GetCommandLineArgs(); 84 | string[] customArgs; 85 | string[] customArgBuffer; 86 | string customArgsStr = ""; 87 | 88 | try 89 | { 90 | customArgsStr = commandLineArgs.Where(row => row.Contains(CUSTOM_ARGS_PREFIX)).Single(); 91 | } 92 | catch (Exception e) 93 | { 94 | Debug.LogError("CommandLineReader.cs - GetCustomArguments() - Can't retrieve any custom arguments in the command line [" + commandLineArgs + "]. Exception: " + e); 95 | return customArgsDict; 96 | } 97 | 98 | customArgsStr = customArgsStr.Replace(CUSTOM_ARGS_PREFIX, ""); 99 | customArgs = customArgsStr.Split(CUSTOM_ARGS_SEPARATOR); 100 | 101 | foreach (string customArg in customArgs) 102 | { 103 | customArgBuffer = customArg.Split('='); 104 | if (customArgBuffer.Length == 2) 105 | { 106 | customArgsDict.Add(customArgBuffer[0], customArgBuffer[1]); 107 | } 108 | else 109 | { 110 | Debug.LogWarning("CommandLineReader.cs - GetCustomArguments() - The custom argument [" + customArg + "] seem to be malformed."); 111 | } 112 | } 113 | 114 | return customArgsDict; 115 | } 116 | 117 | public static string GetCustomArgument(string argumentName) 118 | { 119 | Dictionary customArgsDict = GetCustomArguments(); 120 | 121 | if (customArgsDict.ContainsKey(argumentName)) 122 | { 123 | return customArgsDict[argumentName]; 124 | } 125 | else 126 | { 127 | Debug.LogError("CommandLineReader.cs - GetCustomArgument() - Can't retrieve any custom argument named [" + argumentName + "] in the command line [" + GetCommandLine() + "]."); 128 | return ""; 129 | } 130 | } 131 | } -------------------------------------------------------------------------------- /Assets/Scripts/Com/EpixCode/Util/CommandLineReader.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6b57ceafdb95c78499651eba39ee1f01 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpixCode/CommandLineCustomArguments/f4cd967b591425c99ef2b996fa282bf82850c7bd/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpixCode/CommandLineCustomArguments/f4cd967b591425c99ef2b996fa282bf82850c7bd/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpixCode/CommandLineCustomArguments/f4cd967b591425c99ef2b996fa282bf82850c7bd/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpixCode/CommandLineCustomArguments/f4cd967b591425c99ef2b996fa282bf82850c7bd/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpixCode/CommandLineCustomArguments/f4cd967b591425c99ef2b996fa282bf82850c7bd/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/NavMeshLayers.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpixCode/CommandLineCustomArguments/f4cd967b591425c99ef2b996fa282bf82850c7bd/ProjectSettings/NavMeshLayers.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpixCode/CommandLineCustomArguments/f4cd967b591425c99ef2b996fa282bf82850c7bd/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpixCode/CommandLineCustomArguments/f4cd967b591425c99ef2b996fa282bf82850c7bd/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpixCode/CommandLineCustomArguments/f4cd967b591425c99ef2b996fa282bf82850c7bd/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpixCode/CommandLineCustomArguments/f4cd967b591425c99ef2b996fa282bf82850c7bd/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EpixCode/CommandLineCustomArguments/f4cd967b591425c99ef2b996fa282bf82850c7bd/ProjectSettings/TimeManager.asset --------------------------------------------------------------------------------