-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathVersionSetter.cs
More file actions
29 lines (24 loc) · 878 Bytes
/
VersionSetter.cs
File metadata and controls
29 lines (24 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using UnityEditor;
using System.IO;
using UnityEditor.Callbacks;
using UnityEngine;
namespace Sequence.Config.Editor
{
public static class VersionSetter
{
// Because of the InitializeOnLoad attribute, this method will be called whenever code is recompiled in the editor
[DidReloadScripts]
private static void InjectSDKVersionIntoResources()
{
Debug.Log("Injecting SDK version into Resources 2");
string version = PackageVersionReader.GetVersion();
string versionFilePath = "Assets/Resources/sequence-unity-version.txt";
if (!Directory.Exists("Assets/Resources"))
{
Directory.CreateDirectory("Assets/Resources");
}
File.WriteAllText(versionFilePath, version);
AssetDatabase.Refresh();
}
}
}