Skip to content

Commit db76488

Browse files
committed
Added InfoYGChecker
- Disable Archiving for YG Plugin
1 parent ef54973 commit db76488

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

CustomBuildUpdater/Checkers.meta

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
using System;
2+
using System.IO;
3+
using UnityEditor;
4+
using UnityEngine;
5+
6+
namespace RimuruDev.Unity_CustomBuildUpdater.CustomBuildUpdater.Checkers
7+
{
8+
// TODO: Add log level settings
9+
public static class InfoYGChecker
10+
{
11+
private const string InfoYGPath = "Assets/YandexGame/WorkingData/InfoYG.asset";
12+
13+
[InitializeOnLoadMethod]
14+
private static void CheckAndDisableArchivingBuild()
15+
{
16+
if (File.Exists(InfoYGPath))
17+
{
18+
var infoYGType = GetType("YG.InfoYG");
19+
if (infoYGType != null)
20+
{
21+
var infoYG = AssetDatabase.LoadAssetAtPath(InfoYGPath, infoYGType) as ScriptableObject;
22+
if (infoYG != null)
23+
{
24+
var archivingBuildField = infoYGType.GetField("archivingBuild");
25+
if (archivingBuildField != null)
26+
{
27+
archivingBuildField.SetValue(infoYG, false);
28+
29+
EditorUtility.SetDirty(infoYG);
30+
AssetDatabase.SaveAssets();
31+
AssetDatabase.Refresh();
32+
33+
Debug.Log("InfoYG archivingBuild set to false");
34+
}
35+
// else Debug.LogWarning("Field archivingBuild not found in InfoYG.");
36+
}
37+
// else Debug.LogWarning("InfoYG asset exists but could not be loaded.");
38+
}
39+
// else Debug.LogWarning("Class InfoYG not found in namespace YG.");
40+
}
41+
// else Debug.Log("InfoYG asset does not exist.");
42+
}
43+
44+
private static Type GetType(string typeName)
45+
{
46+
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
47+
{
48+
var type = assembly.GetType(typeName);
49+
50+
if (type != null)
51+
return type;
52+
}
53+
54+
return null;
55+
}
56+
}
57+
}

CustomBuildUpdater/Checkers/CheckAndDisableArchivingBuild.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)