Skip to main content
added 7 characters in body
Source Link
sonnyb
  • 596
  • 1
  • 5
  • 15

In Unity 5.3, there is the PostProcessBuildAttribute. "Add this attribute to a method to get a notification just after building the player." (Source: UnityEditor.Callbacks.PostProcessBuildAttribute documentation.)

Using that attribute, you should be able to set up something like:

[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
    CreateBuildTimestampFile(pathToBuiltProject);
}

private static void CreateBuildTimestampFile(string pathToBuiltProject)
{
    string directory = Path.GetDirectoryName(pathToBuiltProject);

    string timestampFile = Path.Combine(directory, "timestamp.txt");

    if (File.Exists(timestampFile))
    {
        File.Delete(timestampFile);
    }

    using (var streamWriter = File.CreateText(timestampFile))
    {
        var timestamp = System.DateTime.UtcNow.ToString(CultureInfo.InvariantCulture);
        streamWriter.WriteLine(timestamp);
    }
}

As a side note, you may find the Unity 5.3 Build Player Pipeline documentation page useful as well.

In Unity 5.3, there is the PostProcessBuildAttribute. "Add this attribute to a method to get a notification just after building the player." (Source: UnityEditor.Callbacks.PostProcessBuildAttribute documentation.)

Using that attribute, you should be able to set up something like:

[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
    CreateBuildTimestampFile(pathToBuiltProject);
}

private static void CreateBuildTimestampFile(string pathToBuiltProject)
{
    string directory = Path.GetDirectoryName(pathToBuiltProject);

    string timestampFile = Path.Combine(directory, "timestamp.txt");

    if (File.Exists(timestampFile))
    {
        File.Delete(timestampFile);
    }

    using (var streamWriter = File.CreateText(timestampFile))
    {
        var timestamp = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture);
        streamWriter.WriteLine(timestamp);
    }
}

As a side note, you may find the Unity 5.3 Build Player Pipeline documentation page useful as well.

In Unity 5.3, there is the PostProcessBuildAttribute. "Add this attribute to a method to get a notification just after building the player." (Source: UnityEditor.Callbacks.PostProcessBuildAttribute documentation.)

Using that attribute, you should be able to set up something like:

[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
    CreateBuildTimestampFile(pathToBuiltProject);
}

private static void CreateBuildTimestampFile(string pathToBuiltProject)
{
    string directory = Path.GetDirectoryName(pathToBuiltProject);

    string timestampFile = Path.Combine(directory, "timestamp.txt");

    if (File.Exists(timestampFile))
    {
        File.Delete(timestampFile);
    }

    using (var streamWriter = File.CreateText(timestampFile))
    {
        var timestamp = System.DateTime.UtcNow.ToString(CultureInfo.InvariantCulture);
        streamWriter.WriteLine(timestamp);
    }
}

As a side note, you may find the Unity 5.3 Build Player Pipeline documentation page useful as well.

Fix typo
Source Link
sonnyb
  • 596
  • 1
  • 5
  • 15

In Unity 5.3, there is the PostProcessBuildAttribute. "Add this attribute to a method to get a notification just after building the player." (Source: UnityEditor.Callbacks.PostProcessBuildAttribute documentation.)

Using that attribute, you should be able to set up something like:

[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
    CreateBuildTimestampFile(pathToBuiltProject);
}

private static void CreateBuildTimestampFile(string pathToBuiltProject)
{
    string directory = Path.GetDirectoryName(pathToBuiltProject);

    string timestampFile = Path.Combine(directory, "timestamp.txt");

    if (File.Exists(timestampFile))
    {
        File.Delete(timestampFile);
    }

    using (var streamWriter = File.CreateText(timestampFile))
    {
        var timestamp = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture);
        streamWriter.WriteLine(tiestamptimestamp);
    }
}

As a side note, you may find the Unity 5.3 Build Player Pipeline documentation page useful as well.

In Unity 5.3, there is the PostProcessBuildAttribute. "Add this attribute to a method to get a notification just after building the player." (Source: UnityEditor.Callbacks.PostProcessBuildAttribute documentation.)

Using that attribute, you should be able to set up something like:

[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
    CreateBuildTimestampFile(pathToBuiltProject);
}

private static void CreateBuildTimestampFile(string pathToBuiltProject)
{
    string directory = Path.GetDirectoryName(pathToBuiltProject);

    string timestampFile = Path.Combine(directory, "timestamp.txt");

    if (File.Exists(timestampFile))
    {
        File.Delete(timestampFile);
    }

    using (var streamWriter = File.CreateText(timestampFile))
    {
        var timestamp = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture);
        streamWriter.WriteLine(tiestamp);
    }
}

As a side note, you may find the Unity 5.3 Build Player Pipeline documentation page useful as well.

In Unity 5.3, there is the PostProcessBuildAttribute. "Add this attribute to a method to get a notification just after building the player." (Source: UnityEditor.Callbacks.PostProcessBuildAttribute documentation.)

Using that attribute, you should be able to set up something like:

[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
    CreateBuildTimestampFile(pathToBuiltProject);
}

private static void CreateBuildTimestampFile(string pathToBuiltProject)
{
    string directory = Path.GetDirectoryName(pathToBuiltProject);

    string timestampFile = Path.Combine(directory, "timestamp.txt");

    if (File.Exists(timestampFile))
    {
        File.Delete(timestampFile);
    }

    using (var streamWriter = File.CreateText(timestampFile))
    {
        var timestamp = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture);
        streamWriter.WriteLine(timestamp);
    }
}

As a side note, you may find the Unity 5.3 Build Player Pipeline documentation page useful as well.

added 1 character in body
Source Link
sonnyb
  • 596
  • 1
  • 5
  • 15

In Unity 5.3, there is the PostProcessBuildAttribute. "Add this attribute to a method to get a notification just after building the player." (Source: UnityEditor.Callbacks.PostProcessBuildAttribute documentation.)

Using that attribute, you should be able to set up something like:

[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
    CreateBuildTimestampFile(pathToBuiltProject);
}

private static void CreateBuildTimestampFile(string pathToBuiltProject)
{
    string directory = Path.GetDirectoryName(pathToBuiltProject);

    string timestampFile = Path.Combine(directory, "timestamp.txt");

    if (File.Exists(timestampFile))
    {
        File.Delete(timestampFile);
    }

    using (var streamWriter = File.CreateText(timestampFile))
    {
        var timestamp = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture);
        streamWriter.WriteLine(tiestamp);
    }
}

As a side note, you may find the Unity 5.3 Build Player Pipeline documentation page useful as well.

In Unity 5.3, there is the PostProcessBuildAttribute. "Add this attribute to a method to get a notification just after building the player." (Source: UnityEditor.Callbacks.PostProcessBuildAttribute documentation.)

Using that attribute, you should be able to set up something like:

[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)

    CreateBuildTimestampFile(pathToBuiltProject);
}

private static void CreateBuildTimestampFile(string pathToBuiltProject)
{
    string directory = Path.GetDirectoryName(pathToBuiltProject);

    string timestampFile = Path.Combine(directory, "timestamp.txt");

    if (File.Exists(timestampFile))
    {
        File.Delete(timestampFile);
    }

    using (var streamWriter = File.CreateText(timestampFile))
    {
        var timestamp = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture);
        streamWriter.WriteLine(tiestamp);
    }
}

As a side note, you may find the Unity 5.3 Build Player Pipeline documentation page useful as well.

In Unity 5.3, there is the PostProcessBuildAttribute. "Add this attribute to a method to get a notification just after building the player." (Source: UnityEditor.Callbacks.PostProcessBuildAttribute documentation.)

Using that attribute, you should be able to set up something like:

[PostProcessBuild]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
    CreateBuildTimestampFile(pathToBuiltProject);
}

private static void CreateBuildTimestampFile(string pathToBuiltProject)
{
    string directory = Path.GetDirectoryName(pathToBuiltProject);

    string timestampFile = Path.Combine(directory, "timestamp.txt");

    if (File.Exists(timestampFile))
    {
        File.Delete(timestampFile);
    }

    using (var streamWriter = File.CreateText(timestampFile))
    {
        var timestamp = DateTime.UtcNow.ToString(CultureInfo.InvariantCulture);
        streamWriter.WriteLine(tiestamp);
    }
}

As a side note, you may find the Unity 5.3 Build Player Pipeline documentation page useful as well.

Source Link
sonnyb
  • 596
  • 1
  • 5
  • 15
Loading