22 lines
667 B
C#
22 lines
667 B
C#
using UnityEngine;
|
|
|
|
// 出包時的 git commit 短碼 (由 Editor/BuildIdWriter 在 Build 前寫進 Assets/BuildInfo/Resources/build_id.txt)
|
|
// config 的 buildId 用它分辨同一個版號的不同 build ; 編輯器裡一律是 "editor"
|
|
public static class BuildInfo
|
|
{
|
|
private static string id;
|
|
|
|
public static string Id
|
|
{
|
|
get
|
|
{
|
|
if (id == null)
|
|
{
|
|
TextAsset asset = Application.isEditor ? null : Resources.Load<TextAsset>("build_id");
|
|
id = asset != null && !string.IsNullOrWhiteSpace(asset.text) ? asset.text.Trim() : "editor";
|
|
}
|
|
return id;
|
|
}
|
|
}
|
|
}
|