Exemplo n.º 1
0
    /// <summary>
    /// Indicates whether Unity is executing in batch/headless mode, such as during
    /// a Jenkins build or Unity process invoked from the command line.
    /// </summary>
    /// <returns><c>true</c> if is batch mode; otherwise, <c>false</c>.</returns>
    public static bool IsBatchMode()
    {
                #if UNITY_EDITOR
        try {
            foreach (string arg in Environment.GetCommandLineArgs())
            {
                if (!String.IsNullOrEmpty(arg) && arg.ToLower().Contains(BATCH_MODE_ARGUMENT_NAME))
                {
                    return(true);
                }
            }
        } catch (Exception e) {
            _instance.LogError("Cannot determine batch mode status: " + e.ToString());
        }
                #endif

        return(false);
    }