Как упоминалось в моем предыдущем комментарии ранее, вы можете полностью автоматизировать, включая .txt
файл с вашей сборкой, содержащий дату / время сборки, используя Build Player PipeLine . Без необходимости создавать свою собственную систему сборки с пользовательским интерфейсом (если я не понял неправильно, и у вас есть своя собственная система сборки. Но даже в этом случае она может быть включена и в это).
Важно: Сценарий постпроцессора нуждается в находиться в папке с именем Editor
, если это не так, выдаст ошибок при сборке. В моем примере скрипт находится в /Assets/Scripts/Editor/PostBuildScript.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System;
using System.IO;
public class BuildScript
{
//Script is called after the building process, BuildTarget and string pathToBuiltProject are mandatory arguments
[PostProcessBuildAttribute(1)]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
//Give the user a file folder pop-up asking for the location you wish to save the file to
string path = EditorUtility.SaveFolderPanel("Save location", "", "");
//Alternative you can also just hardcode the path..
//string path = "C:/Dev/Unity/MyProject/MyBuilds/
//Get the current datetime and convert it to a string with some explanatory text
string date = string.Format("Build date: {0}", DateTime.Now.ToString());
//Write the date to a text file called "BuildDate.txt" at the selected location
File.WriteAllText(path + "BuildDate.txt", date);
}
}
Теперь после сборки файл «BuildDate.txt» будет включен в выбранное место, содержащее DateTime сборки (например Build date: 19/02/2020 20:29:30
)