Пример #1
0
        /// <summary>
        /// Saves changes of <i>ProjectSettings.asset</i> and delete temporary file.
        /// After this and until a new call to <see cref="SaveSettingsToRestore"/>,
        /// the call to <see cref="RestoreSettings"/> does not produce any effect.
        /// </summary>
        public static void AcceptChangedSettings()
        {
            var settingsPathTemp = BuildHelperStrings.ProjRoot(_SETTINGS_TEMP_PATH);

            if (File.Exists(settingsPathTemp))
            {
                File.Delete(settingsPathTemp);
            }
            _settingsAlreadySaved = false;
            AssetDatabase.SaveAssets();
            Debug.Log("BuildTime: Project Settings accepted");
        }
Пример #2
0
        /// <summary>
        /// Implements <see cref="IPreprocessBuild.OnPreprocessBuild"/>.
        /// Is performed before all the build processes, saves <i>ProjectSettings.asset</i> and
        /// sets build version.
        /// </summary>
        /// <param name="target"></param>
        /// <param name="path"></param>
        public void OnPreprocessBuild(BuildTarget target, string path)
        {
#if UNITY_EDITOR_LINUX && WORKAROUND_ANDROID_UNITY_SHADER_COMPILER_BUG
            if (target == BuildTarget.Android)
            {
                KillUnityShaderCompiler();
            }
#endif
            Debug.Log("Starting build to: " + path);
            SaveSettingsToRestore();
            PlayerSettings.bundleVersion = BuildHelperStrings.GetBuildVersion();
        }
Пример #3
0
 /// <summary>
 /// Saves <i>ProjectSettings.asset</i> to temporary file for change and then restore.
 /// </summary>
 /// <seealso cref="RestoreSettings"/>
 /// <seealso cref="RestoreSettingsIfFailed"/>
 public static void SaveSettingsToRestore()
 {
     KeepKeystoreInfo();
     if (!_settingsAlreadySaved)
     {
         var settingsPath     = BuildHelperStrings.ProjRoot(_SETTINGS_PATH);
         var settingsPathTemp = BuildHelperStrings.ProjRoot(_SETTINGS_TEMP_PATH);
         File.Copy(settingsPath, settingsPathTemp, true);
         _settingsAlreadySaved = true;
         Debug.Log("BuildTime: Project Settings saved");
     }
 }
Пример #4
0
 /// <summary>
 /// Create request for program located in specified <i>path</i>.
 /// Working directory for program sets to project root.
 /// </summary>
 /// <param name="path">Path to external program</param>
 /// <param name="args">Comand line arguments</param>
 public ProgramRequest(string path, string args = "")
 {
     _process = new Process {
         StartInfo =
         {
             FileName               = path,
             Arguments              = args,
             WorkingDirectory       = BuildHelperStrings.ProjRoot(),
             CreateNoWindow         = true,
             RedirectStandardOutput = true,
             RedirectStandardError  = true,
             UseShellExecute        = false
         }
     };
 }
Пример #5
0
        /// <summary>
        /// Restores the saved <i>ProjectSettings.asset</i> and refresh Unity asset database.
        /// If <i>ProjectSettings.asset</i> is not saved then nothing will happen.
        /// </summary>
        /// <remarks>It is better to use <see cref="RestoreSettingsIfFailed"/> if there is no guarantee
        /// that the build process will not break with the exception
        /// and <i>RestoreSettings</i> is not executed.</remarks>
        /// <seealso cref="SaveSettingsToRestore"/>
        public static void RestoreSettings()
        {
            var settingsPath     = BuildHelperStrings.ProjRoot(_SETTINGS_PATH);
            var settingsPathTemp = BuildHelperStrings.ProjRoot(_SETTINGS_TEMP_PATH);

            if (File.Exists(settingsPathTemp))
            {
                File.Copy(settingsPathTemp, settingsPath, true);
                File.Delete(settingsPathTemp);
                Debug.Log("BuildTime: Project Settings restored");
                AssetDatabase.Refresh();
            }
            _settingsAlreadySaved = false;
            RestoreKeystoreInfo();
        }