-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Disable Archiving for YG Plugin
- Loading branch information
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
CustomBuildUpdater/Checkers/CheckAndDisableArchivingBuild.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using System.IO; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace RimuruDev.Unity_CustomBuildUpdater.CustomBuildUpdater.Checkers | ||
{ | ||
// TODO: Add log level settings | ||
public static class InfoYGChecker | ||
{ | ||
private const string InfoYGPath = "Assets/YandexGame/WorkingData/InfoYG.asset"; | ||
|
||
[InitializeOnLoadMethod] | ||
private static void CheckAndDisableArchivingBuild() | ||
{ | ||
if (File.Exists(InfoYGPath)) | ||
{ | ||
var infoYGType = GetType("YG.InfoYG"); | ||
if (infoYGType != null) | ||
{ | ||
var infoYG = AssetDatabase.LoadAssetAtPath(InfoYGPath, infoYGType) as ScriptableObject; | ||
if (infoYG != null) | ||
{ | ||
var archivingBuildField = infoYGType.GetField("archivingBuild"); | ||
if (archivingBuildField != null) | ||
{ | ||
archivingBuildField.SetValue(infoYG, false); | ||
|
||
EditorUtility.SetDirty(infoYG); | ||
AssetDatabase.SaveAssets(); | ||
AssetDatabase.Refresh(); | ||
|
||
Debug.Log("InfoYG archivingBuild set to false"); | ||
} | ||
// else Debug.LogWarning("Field archivingBuild not found in InfoYG."); | ||
} | ||
// else Debug.LogWarning("InfoYG asset exists but could not be loaded."); | ||
} | ||
// else Debug.LogWarning("Class InfoYG not found in namespace YG."); | ||
} | ||
// else Debug.Log("InfoYG asset does not exist."); | ||
} | ||
|
||
private static Type GetType(string typeName) | ||
{ | ||
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) | ||
{ | ||
var type = assembly.GetType(typeName); | ||
|
||
if (type != null) | ||
return type; | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
CustomBuildUpdater/Checkers/CheckAndDisableArchivingBuild.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.