| 123456789101112131415161718192021222324252627 |
- using System;
- using HybridCLR.Settings;
- using UnityEditor;
- using UnityEditorInternal;
- namespace HotPatch.Editor
- {
- [InitializeOnLoad]
- public static class HotPatchSettingsIntegration
- {
- static HotPatchSettingsIntegration() => HotPatchAssemblySelection.ApplyHybridCLRSettings = Apply;
- public static void Apply(AssemblyDefinitionAsset assembly)
- {
- if (assembly != null) HotPatchAssemblySelection.Validate(assembly);
- var settings = HybridCLRSettings.instance;
- Undo.RecordObject(settings, "Select hot-patch assembly");
- settings.enable = true;
- settings.hotUpdateAssemblyDefinitions = assembly != null ? new[] { assembly } : Array.Empty<AssemblyDefinitionAsset>();
- settings.hotUpdateAssemblies = Array.Empty<string>();
- settings.preserveHotUpdateAssemblies = Array.Empty<string>();
- EditorUtility.SetDirty(settings);
- HybridCLRSettings.Save();
- }
- }
- }
|