maint: hotreload updated to 1.13.7

This commit is contained in:
Chris
2026-01-06 22:42:15 -05:00
parent 796dbca5d8
commit 105da8850a
128 changed files with 3538 additions and 738 deletions

View File

@@ -2,6 +2,7 @@ using System;
using System.Diagnostics.CodeAnalysis;
using SingularityGroup.HotReload.DTO;
using SingularityGroup.HotReload.Editor.Cli;
using SingularityGroup.HotReload.Editor.Localization;
using UnityEditor;
using UnityEngine;
using EditorGUI = UnityEditor.EditorGUI;
@@ -49,9 +50,9 @@ namespace SingularityGroup.HotReload.Editor {
[SuppressMessage("ReSharper", "Unity.UnknownResource")] // Rider doesn't check packages
public HotReloadSettingsTab(HotReloadWindow window) : base(window,
"Settings",
Translations.Settings.SettingsTitle,
"_Popup",
"Make changes to a build running on-device.") {
Translations.OnDevice.OnDeviceHeadline) {
optionsSection = new HotReloadOptionsSection();
}
@@ -98,7 +99,7 @@ namespace SingularityGroup.HotReload.Editor {
using (new EditorGUILayout.HorizontalScope(HotReloadWindowStyles.SectionOuterBoxCompact)) {
using (new EditorGUILayout.HorizontalScope(HotReloadWindowStyles.SectionInnerBoxWide)) {
using (new EditorGUILayout.VerticalScope()) {
HotReloadPrefs.ShowConfiguration = EditorGUILayout.Foldout(HotReloadPrefs.ShowConfiguration, "Settings", true, HotReloadWindowStyles.FoldoutStyle);
HotReloadPrefs.ShowConfiguration = EditorGUILayout.Foldout(HotReloadPrefs.ShowConfiguration, Translations.Settings.SettingsConfiguration, true, HotReloadWindowStyles.FoldoutStyle);
if (HotReloadPrefs.ShowConfiguration) {
EditorGUILayout.Space();
@@ -111,8 +112,10 @@ namespace SingularityGroup.HotReload.Editor {
RenderAutoRecompileUnsupportedChangesImmediately();
RenderAutoRecompileUnsupportedChangesOnExitPlayMode();
RenderAutoRecompileUnsupportedChangesInPlayMode();
RenderAutoRecompileInspectorFieldEdits();
RenderAutoRecompilePartiallyUnsupportedChanges();
RenderDisplayNewMonobehaviourMethodsAsPartiallySupported();
RenderAutoRecompileUnsupportedChangesInEditMode();
}
}
EditorGUILayout.Space();
@@ -186,12 +189,13 @@ namespace SingularityGroup.HotReload.Editor {
using (new EditorGUILayout.HorizontalScope(HotReloadWindowStyles.SectionOuterBoxCompact)) {
using (new EditorGUILayout.HorizontalScope(HotReloadWindowStyles.SectionInnerBoxWide)) {
using (new EditorGUILayout.VerticalScope()) {
HotReloadPrefs.ShowAdvanced = EditorGUILayout.Foldout(HotReloadPrefs.ShowAdvanced, "Advanced", true, HotReloadWindowStyles.FoldoutStyle);
HotReloadPrefs.ShowAdvanced = EditorGUILayout.Foldout(HotReloadPrefs.ShowAdvanced, Translations.Settings.SettingsAdvanced, true, HotReloadWindowStyles.FoldoutStyle);
if (HotReloadPrefs.ShowAdvanced) {
EditorGUILayout.Space();
DeactivateHotReload();
DisableDetailedErrorReporting();
PauseHotReloadInEditMode();
}
}
}
@@ -201,15 +205,15 @@ namespace SingularityGroup.HotReload.Editor {
}
void RenderUnityAutoRefresh() {
var newSettings = EditorGUILayout.BeginToggleGroup(new GUIContent("Manage Unity auto-refresh (recommended)"), HotReloadPrefs.AllowDisableUnityAutoRefresh);
var newSettings = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.ToggleManageAutoRefresh), HotReloadPrefs.AllowDisableUnityAutoRefresh);
if (newSettings != HotReloadPrefs.AllowDisableUnityAutoRefresh) {
HotReloadPrefs.AllowDisableUnityAutoRefresh = newSettings;
}
string toggleDescription;
if (HotReloadPrefs.AllowDisableUnityAutoRefresh) {
toggleDescription = "To avoid unnecessary recompiling, Hot Reload will automatically change Unity's Auto Refresh and Script Compilation settings. Previous settings will be restored when Hot Reload is stopped";
toggleDescription = Translations.Settings.SettingsManageAutoRefreshOn;
} else {
toggleDescription = "Enabled this setting to auto-manage Unity's Auto Refresh and Script Compilation settings. This reduces unncessary recompiling";
toggleDescription = Translations.Settings.SettingsManageAutoRefreshOff;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
@@ -217,15 +221,14 @@ namespace SingularityGroup.HotReload.Editor {
}
void RenderAssetRefresh() {
var newSettings = EditorGUILayout.BeginToggleGroup(new GUIContent("Asset refresh (recommended)"), HotReloadPrefs.AllAssetChanges);
var newSettings = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.ToggleAssetRefresh), HotReloadPrefs.AllAssetChanges);
if (newSettings != HotReloadPrefs.AllAssetChanges) {
HotReloadPrefs.AllAssetChanges = newSettings;
// restart when setting changes
if (ServerHealthCheck.I.IsServerHealthy) {
var restartServer = EditorUtility.DisplayDialog("Hot Reload",
$"When changing 'Asset refresh', the Hot Reload server must be restarted for this to take effect." +
"\nDo you want to restart it now?",
"Restart Hot Reload", "Don't restart");
var restartServer = EditorUtility.DisplayDialog(Translations.Dialogs.DialogTitleRestartServer,
Translations.Dialogs.DialogMessageRestartAssetRefresh,
Translations.Dialogs.DialogButtonRestartHotReload, Translations.Dialogs.DialogButtonDontRestart);
if (restartServer) {
EditorCodePatcher.RestartCodePatcher().Forget();
}
@@ -233,9 +236,9 @@ namespace SingularityGroup.HotReload.Editor {
}
string toggleDescription;
if (HotReloadPrefs.AllAssetChanges) {
toggleDescription = "Hot Reload will refresh changed assets such as sprites, prefabs, etc";
toggleDescription = Translations.Settings.SettingsAssetRefreshOn;
} else {
toggleDescription = "Enable to allow Hot Reload to refresh changed assets in the project. All asset types are supported including sprites, prefabs, shaders etc";
toggleDescription = Translations.Settings.SettingsAssetRefreshOff;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
@@ -243,16 +246,16 @@ namespace SingularityGroup.HotReload.Editor {
}
void RenderDebuggerCompatibility() {
var newSettings = EditorGUILayout.BeginToggleGroup(new GUIContent("Auto-disable Hot Reload while a debugger is attached (recommended)"), HotReloadPrefs.AutoDisableHotReloadWithDebugger);
var newSettings = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.ToggleDebuggerCompatibility), HotReloadPrefs.AutoDisableHotReloadWithDebugger);
if (newSettings != HotReloadPrefs.AutoDisableHotReloadWithDebugger) {
HotReloadPrefs.AutoDisableHotReloadWithDebugger = newSettings;
CodePatcher.I.debuggerCompatibilityEnabled = !HotReloadPrefs.AutoDisableHotReloadWithDebugger;
}
string toggleDescription;
if (HotReloadPrefs.AutoDisableHotReloadWithDebugger) {
toggleDescription = "Hot Reload automatically disables itself while a debugger is attached, as it can otherwise interfere with certain debugger features. Please read the documentation if you consider disabling this setting.";
toggleDescription = Translations.Settings.SettingsDebuggerCompatibilityOn;
} else {
toggleDescription = "When a debugger is attached, Hot Reload will be active, but certain debugger features might not work as expected. Please read our documentation to learn about the limitations.";
toggleDescription = Translations.Settings.SettingsDebuggerCompatibilityOff;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
@@ -260,12 +263,12 @@ namespace SingularityGroup.HotReload.Editor {
}
void RenderIncludeShaderChanges() {
HotReloadPrefs.IncludeShaderChanges = EditorGUILayout.BeginToggleGroup(new GUIContent("Refresh shaders"), HotReloadPrefs.IncludeShaderChanges);
HotReloadPrefs.IncludeShaderChanges = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.ToggleRefreshShaders), HotReloadPrefs.IncludeShaderChanges);
string toggleDescription;
if (HotReloadPrefs.IncludeShaderChanges) {
toggleDescription = "Hot Reload will auto refresh shaders. Note that enabling this setting might impact performance.";
toggleDescription = Translations.Settings.SettingsRefreshShadersOn;
} else {
toggleDescription = "Enable to auto-refresh shaders. Note that enabling this setting might impact performance";
toggleDescription = Translations.Settings.SettingsRefreshShadersOff;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
@@ -275,15 +278,14 @@ namespace SingularityGroup.HotReload.Editor {
if (!HotReloadCli.CanOpenInBackground) {
return;
}
var newSettings = EditorGUILayout.BeginToggleGroup(new GUIContent("Hide console window on start"), HotReloadPrefs.DisableConsoleWindow);
var newSettings = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.ToggleHideConsole), HotReloadPrefs.DisableConsoleWindow);
if (newSettings != HotReloadPrefs.DisableConsoleWindow) {
HotReloadPrefs.DisableConsoleWindow = newSettings;
// restart when setting changes
if (ServerHealthCheck.I.IsServerHealthy) {
var restartServer = EditorUtility.DisplayDialog("Hot Reload",
$"When changing 'Hide console window on start', the Hot Reload server must be restarted for this to take effect." +
"\nDo you want to restart it now?",
"Restart server", "Don't restart");
var restartServer = EditorUtility.DisplayDialog(Translations.Dialogs.DialogTitleRestartServer,
Translations.Dialogs.DialogMessageRestartConsoleWindow,
Translations.Dialogs.DialogButtonRestartServer, Translations.Dialogs.DialogButtonDontRestart);
if (restartServer) {
EditorCodePatcher.RestartCodePatcher().Forget();
}
@@ -291,9 +293,9 @@ namespace SingularityGroup.HotReload.Editor {
}
string toggleDescription;
if (HotReloadPrefs.DisableConsoleWindow) {
toggleDescription = "Hot Reload will start without creating a console window. Logs can be accessed through \"Help\" tab.";
toggleDescription = Translations.Settings.SettingsHideConsoleOn;
} else {
toggleDescription = "Enable to start Hot Reload without creating a console window.";
toggleDescription = Translations.Settings.SettingsHideConsoleOff;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
@@ -301,15 +303,15 @@ namespace SingularityGroup.HotReload.Editor {
}
void DeactivateHotReload() {
var newSettings = EditorGUILayout.BeginToggleGroup(new GUIContent("Deactivate Hot Reload"), HotReloadPrefs.DeactivateHotReload);
var newSettings = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.ToggleDeactivate), HotReloadPrefs.DeactivateHotReload);
if (newSettings != HotReloadPrefs.DeactivateHotReload) {
DeactivateHotReloadInner(newSettings);
}
string toggleDescription;
if (HotReloadPrefs.DeactivateHotReload) {
toggleDescription = "Hot Reload is deactivated.";
toggleDescription = Translations.Settings.SettingsDeactivatedOn;
} else {
toggleDescription = "Enable to deactivate Hot Reload.";
toggleDescription = Translations.Settings.SettingsDeactivatedOff;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
@@ -317,13 +319,26 @@ namespace SingularityGroup.HotReload.Editor {
}
void DisableDetailedErrorReporting() {
var newSettings = EditorGUILayout.BeginToggleGroup(new GUIContent("Disable Detailed Error Reporting"), HotReloadPrefs.DisableDetailedErrorReporting);
var newSettings = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.ToggleDisableErrorReporting), HotReloadPrefs.DisableDetailedErrorReporting);
DisableDetailedErrorReportingInner(newSettings);
string toggleDescription;
if (HotReloadPrefs.DisableDetailedErrorReporting) {
toggleDescription = "Detailed error reporting is disabled.";
toggleDescription = Translations.Settings.SettingsDisableErrorReportingOn;
} else {
toggleDescription = "Toggle on to disable detailed error reporting.";
toggleDescription = Translations.Settings.SettingsDisableErrorReportingOff;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
EditorGUILayout.Space(6f);
}
void PauseHotReloadInEditMode() {
HotReloadPrefs.PauseHotReloadInEditMode = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.TogglePauseEditMode), HotReloadPrefs.PauseHotReloadInEditMode);
string toggleDescription;
if (HotReloadPrefs.PauseHotReloadInEditMode) {
toggleDescription = Translations.Settings.SettingsPauseEditModeOn;
} else {
toggleDescription = Translations.Settings.SettingsPauseEditModeOff;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
@@ -337,10 +352,9 @@ namespace SingularityGroup.HotReload.Editor {
HotReloadPrefs.DisableDetailedErrorReporting = newSetting;
// restart when setting changes
if (ServerHealthCheck.I.IsServerHealthy) {
var restartServer = EditorUtility.DisplayDialog("Hot Reload",
$"When changing 'Disable Detailed Error Reporting', the Hot Reload server must be restarted for this to take effect." +
"\nDo you want to restart it now?",
"Restart server", "Don't restart");
var restartServer = EditorUtility.DisplayDialog(Translations.Dialogs.DialogTitleRestartServer,
Translations.Dialogs.DialogMessageRestartErrorReporting,
Translations.Dialogs.DialogButtonRestartServer, Translations.Dialogs.DialogButtonDontRestart);
if (restartServer) {
EditorCodePatcher.RestartCodePatcher().Forget();
}
@@ -348,10 +362,9 @@ namespace SingularityGroup.HotReload.Editor {
}
static void DeactivateHotReloadInner(bool deactivate) {
var confirmed = !deactivate || EditorUtility.DisplayDialog("Hot Reload",
$"Hot Reload will be completely deactivated (unusable) until you activate it again." +
"\n\nDo you want to proceed?",
"Deactivate", "Cancel");
var confirmed = !deactivate || EditorUtility.DisplayDialog(Translations.Dialogs.DialogTitleDeactivate,
Translations.Dialogs.DialogMessageDeactivate,
Translations.Dialogs.DialogButtonDeactivate, Translations.Common.ButtonCancel);
if (confirmed) {
HotReloadPrefs.DeactivateHotReload = deactivate;
if (deactivate) {
@@ -363,15 +376,15 @@ namespace SingularityGroup.HotReload.Editor {
}
void RenderAutostart() {
var newSettings = EditorGUILayout.BeginToggleGroup(new GUIContent("Autostart on Unity open"), HotReloadPrefs.LaunchOnEditorStart);
var newSettings = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.ToggleAutostart), HotReloadPrefs.LaunchOnEditorStart);
if (newSettings != HotReloadPrefs.LaunchOnEditorStart) {
HotReloadPrefs.LaunchOnEditorStart = newSettings;
}
string toggleDescription;
if (HotReloadPrefs.LaunchOnEditorStart) {
toggleDescription = "Hot Reload will be launched when Unity project opens.";
toggleDescription = Translations.Settings.SettingsAutostartOn;
} else {
toggleDescription = "Enable to launch Hot Reload when Unity project opens.";
toggleDescription = Translations.Settings.SettingsAutostartOff;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
@@ -380,11 +393,11 @@ namespace SingularityGroup.HotReload.Editor {
void RenderShowNotifications() {
EditorGUILayout.Space(10f);
GUILayout.Label("Visual Feedback", HotReloadWindowStyles.NotificationsTitleStyle);
GUILayout.Label(Translations.Settings.SettingsVisualFeedback, HotReloadWindowStyles.NotificationsTitleStyle);
EditorGUILayout.Space(10f);
if (!EditorWindowHelper.supportsNotifications && !UnitySettingsHelper.I.playmodeTintSupported) {
var toggleDescription = "Indications are not supported in the Unity version you use.";
var toggleDescription = Translations.Settings.SettingsIndicationsUnsupported;
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
}
}
@@ -396,19 +409,19 @@ namespace SingularityGroup.HotReload.Editor {
void RenderMiscHeader() {
EditorGUILayout.Space(10f);
GUILayout.Label("Misc", HotReloadWindowStyles.NotificationsTitleStyle);
GUILayout.Label(Translations.Settings.SettingsMisc, HotReloadWindowStyles.NotificationsTitleStyle);
EditorGUILayout.Space(10f);
}
void RenderShowPatchingNotifications() {
HotReloadPrefs.ShowPatchingNotifications = EditorGUILayout.BeginToggleGroup(new GUIContent("Patching Indication"), HotReloadPrefs.ShowPatchingNotifications);
HotReloadPrefs.ShowPatchingNotifications = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.TogglePatchingIndication), HotReloadPrefs.ShowPatchingNotifications);
string toggleDescription;
if (!EditorWindowHelper.supportsNotifications) {
toggleDescription = "Patching Notification is not supported in the Unity version you use.";
toggleDescription = Translations.Settings.SettingsPatchingIndicationUnsupported;
} else if (!HotReloadPrefs.ShowPatchingNotifications) {
toggleDescription = "Enable to show GameView and SceneView indications when Patching.";
toggleDescription = Translations.Settings.SettingsPatchingIndicationOff;
} else {
toggleDescription = "Indications will be shown in GameView and SceneView when Patching.";
toggleDescription = Translations.Settings.SettingsPatchingIndicationOn;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
@@ -427,16 +440,15 @@ namespace SingularityGroup.HotReload.Editor {
// EditorGUILayout.EndToggleGroup();
// }
[Obsolete("Not implemented")]
[Obsolete(Translations.MenuItems.NotImplementedObsolete)]
public static void ApplyApplyFieldInitializerEditsToExistingClassInstances(bool newSetting) {
if (newSetting != HotReloadPrefs.ApplyFieldInitiailzerEditsToExistingClassInstances) {
HotReloadPrefs.ApplyFieldInitiailzerEditsToExistingClassInstances = newSetting;
// restart when setting changes
if (ServerHealthCheck.I.IsServerHealthy) {
var restartServer = EditorUtility.DisplayDialog("Hot Reload",
$"When changing 'Apply field initializer edits to existing class instances' setting, the Hot Reload server must restart for it to take effect." +
"\nDo you want to restart it now?",
"Restart server", "Don't restart");
var restartServer = EditorUtility.DisplayDialog(Translations.Dialogs.DialogTitleRestartServer,
Translations.Dialogs.DialogMessageRestartFieldInitializer,
Translations.Dialogs.DialogButtonRestartServer, Translations.Dialogs.DialogButtonDontRestart);
if (restartServer) {
EditorCodePatcher.RestartCodePatcher().Forget();
}
@@ -445,95 +457,128 @@ namespace SingularityGroup.HotReload.Editor {
}
void RenderShowCompilingUnsupportedNotifications() {
HotReloadPrefs.ShowCompilingUnsupportedNotifications = EditorGUILayout.BeginToggleGroup(new GUIContent("Compiling Unsupported Changes Indication"), HotReloadPrefs.ShowCompilingUnsupportedNotifications);
HotReloadPrefs.ShowCompilingUnsupportedNotifications = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.ToggleCompilingIndication), HotReloadPrefs.ShowCompilingUnsupportedNotifications);
string toggleDescription;
if (!EditorWindowHelper.supportsNotifications) {
toggleDescription = "Compiling Unsupported Changes Notification is not supported in the Unity version you use.";
toggleDescription = Translations.Settings.SettingsCompilingIndicationUnsupported;
} else if (!HotReloadPrefs.ShowCompilingUnsupportedNotifications) {
toggleDescription = "Enable to show GameView and SceneView indications when compiling unsupported changes.";
toggleDescription = Translations.Settings.SettingsCompilingIndicationOff;
} else {
toggleDescription = "Indications will be shown in GameView and SceneView when compiling unsupported changes.";
toggleDescription = Translations.Settings.SettingsCompilingIndicationOn;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
}
void RenderAutoRecompileUnsupportedChanges() {
HotReloadPrefs.AutoRecompileUnsupportedChanges = EditorGUILayout.BeginToggleGroup(new GUIContent("Auto recompile unsupported changes (recommended)"), HotReloadPrefs.AutoRecompileUnsupportedChanges && EditorCodePatcher.autoRecompileUnsupportedChangesSupported);
HotReloadPrefs.AutoRecompileUnsupportedChanges = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.ToggleAutoRecompile), HotReloadPrefs.AutoRecompileUnsupportedChanges && EditorCodePatcher.autoRecompileUnsupportedChangesSupported);
string toggleDescription;
if (!EditorCodePatcher.autoRecompileUnsupportedChangesSupported) {
toggleDescription = "Auto recompiling unsupported changes is not supported in the Unity version you use.";
toggleDescription = Translations.Settings.SettingsAutoRecompileUnsupported;
} else if (HotReloadPrefs.AutoRecompileUnsupportedChanges) {
toggleDescription = "Hot Reload will recompile automatically after code changes that Hot Reload doesn't support.";
toggleDescription = Translations.Settings.SettingsAutoRecompileOn;
} else {
toggleDescription = "When enabled, recompile happens automatically after code changes that Hot Reload doesn't support.";
toggleDescription = Translations.Settings.SettingsAutoRecompileOff;
}
if (!HotReloadPrefs.AutoRecompileUnsupportedChangesInEditMode && !HotReloadPrefs.AutoRecompileUnsupportedChangesInPlayMode) {
HotReloadPrefs.AutoRecompileUnsupportedChangesInEditMode = true;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
}
void RenderAutoRecompileInspectorFieldEdits() {
HotReloadPrefs.AutoRecompileInspectorFieldsEdit = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.ToggleAutoRecompileInspector), HotReloadPrefs.AutoRecompileInspectorFieldsEdit);
string toggleDescription;
if (HotReloadPrefs.AutoRecompileInspectorFieldsEdit) {
toggleDescription = Translations.Settings.SettingsAutoRecompileInspectorOn;
} else {
toggleDescription = Translations.Settings.SettingsAutoRecompileInspectorOff;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
}
void RenderAutoRecompilePartiallyUnsupportedChanges() {
HotReloadPrefs.AutoRecompilePartiallyUnsupportedChanges = EditorGUILayout.BeginToggleGroup(new GUIContent("Include partially unsupported changes"), HotReloadPrefs.AutoRecompilePartiallyUnsupportedChanges);
HotReloadPrefs.AutoRecompilePartiallyUnsupportedChanges = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.ToggleAutoRecompilePartial), HotReloadPrefs.AutoRecompilePartiallyUnsupportedChanges);
string toggleDescription;
if (HotReloadPrefs.AutoRecompilePartiallyUnsupportedChanges) {
toggleDescription = "Hot Reload will recompile partially unsupported changes.";
toggleDescription = Translations.Settings.SettingsAutoRecompilePartialOn;
} else {
toggleDescription = "Enable to recompile partially unsupported changes.";
toggleDescription = Translations.Settings.SettingsAutoRecompilePartialOff;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
}
void RenderDisplayNewMonobehaviourMethodsAsPartiallySupported() {
HotReloadPrefs.DisplayNewMonobehaviourMethodsAsPartiallySupported = EditorGUILayout.BeginToggleGroup(new GUIContent("Display new Monobehaviour methods as partially supported"), HotReloadPrefs.DisplayNewMonobehaviourMethodsAsPartiallySupported);
HotReloadPrefs.DisplayNewMonobehaviourMethodsAsPartiallySupported = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.ToggleDisplayMonobehaviour), HotReloadPrefs.DisplayNewMonobehaviourMethodsAsPartiallySupported);
string toggleDescription;
if (HotReloadPrefs.DisplayNewMonobehaviourMethodsAsPartiallySupported) {
toggleDescription = "Hot Reload will display new monobehaviour methods as partially unsupported.";
toggleDescription = Translations.Settings.SettingsDisplayMonobehaviourOn;
} else {
toggleDescription = "Enable to display new monobehaviour methods as partially unsupported.";
toggleDescription = Translations.Settings.SettingsDisplayMonobehaviourOff;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
}
void RenderAutoRecompileUnsupportedChangesImmediately() {
HotReloadPrefs.AutoRecompileUnsupportedChangesImmediately = EditorGUILayout.BeginToggleGroup(new GUIContent("Recompile immediately"), HotReloadPrefs.AutoRecompileUnsupportedChangesImmediately);
HotReloadPrefs.AutoRecompileUnsupportedChangesImmediately = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.ToggleRecompileImmediately), HotReloadPrefs.AutoRecompileUnsupportedChangesImmediately);
string toggleDescription;
if (HotReloadPrefs.AutoRecompileUnsupportedChangesImmediately) {
toggleDescription = "Unsupported changes will be recompiled immediately.";
toggleDescription = Translations.Settings.SettingsRecompileImmediatelyOn;
} else {
toggleDescription = "Unsupported changes will be recompiled when editor is focused. Enable to recompile immediately.";
toggleDescription = Translations.Settings.SettingsRecompileImmediatelyOff;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
}
void RenderAutoRecompileUnsupportedChangesInPlayMode() {
HotReloadPrefs.AutoRecompileUnsupportedChangesInPlayMode = EditorGUILayout.BeginToggleGroup(new GUIContent("Recompile in Play Mode"), HotReloadPrefs.AutoRecompileUnsupportedChangesInPlayMode);
HotReloadPrefs.AutoRecompileUnsupportedChangesInPlayMode = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.ToggleRecompilePlayMode), HotReloadPrefs.AutoRecompileUnsupportedChangesInPlayMode);
string toggleDescription;
if (HotReloadPrefs.AutoRecompileUnsupportedChangesInPlayMode) {
toggleDescription = "Hot Reload will exit Play Mode to recompile unsupported changes.";
toggleDescription = Translations.Settings.SettingsRecompilePlayModeOn;
} else {
toggleDescription = "Enable to auto exit Play Mode to recompile unsupported changes.";
toggleDescription = Translations.Settings.SettingsRecompilePlayModeOff;
}
if (!HotReloadPrefs.AutoRecompileUnsupportedChangesInEditMode && !HotReloadPrefs.AutoRecompileUnsupportedChangesInPlayMode) {
HotReloadPrefs.AutoRecompileUnsupportedChanges = false;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
}
void RenderAutoRecompileUnsupportedChangesInEditMode() {
HotReloadPrefs.AutoRecompileUnsupportedChangesInEditMode = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.ToggleRecompileEditMode), HotReloadPrefs.AutoRecompileUnsupportedChangesInEditMode);
string toggleDescription;
if (HotReloadPrefs.AutoRecompileUnsupportedChangesInEditMode) {
toggleDescription = Translations.Settings.SettingsRecompileEditModeOn;
} else {
toggleDescription = Translations.Settings.SettingsRecompileEditModeOff;
}
if (!HotReloadPrefs.AutoRecompileUnsupportedChangesInEditMode && !HotReloadPrefs.AutoRecompileUnsupportedChangesInPlayMode) {
HotReloadPrefs.AutoRecompileUnsupportedChanges = false;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
}
void RenderAutoRecompileUnsupportedChangesOnExitPlayMode() {
HotReloadPrefs.AutoRecompileUnsupportedChangesOnExitPlayMode = EditorGUILayout.BeginToggleGroup(new GUIContent("Recompile on exit Play Mode"), HotReloadPrefs.AutoRecompileUnsupportedChangesOnExitPlayMode);
HotReloadPrefs.AutoRecompileUnsupportedChangesOnExitPlayMode = EditorGUILayout.BeginToggleGroup(new GUIContent(Translations.Settings.ToggleRecompileExitPlayMode), HotReloadPrefs.AutoRecompileUnsupportedChangesOnExitPlayMode);
string toggleDescription;
if (HotReloadPrefs.AutoRecompileUnsupportedChangesOnExitPlayMode) {
toggleDescription = "Hot Reload will recompile unsupported changes when exiting Play Mode.";
toggleDescription = Translations.Settings.SettingsRecompileExitPlayModeOn;
} else {
toggleDescription = "Enable to recompile unsupported changes when exiting Play Mode.";
toggleDescription = Translations.Settings.SettingsRecompileExitPlayModeOff;
}
EditorGUILayout.LabelField(toggleDescription, HotReloadWindowStyles.WrapStyle);
EditorGUILayout.EndToggleGroup();
}
void RenderOnDevice() {
HotReloadPrefs.ShowOnDevice = EditorGUILayout.Foldout(HotReloadPrefs.ShowOnDevice, "On-Device", true, HotReloadWindowStyles.FoldoutStyle);
HotReloadPrefs.ShowOnDevice = EditorGUILayout.Foldout(HotReloadPrefs.ShowOnDevice, Translations.Settings.SettingsOnDevice, true, HotReloadWindowStyles.FoldoutStyle);
if (!HotReloadPrefs.ShowOnDevice) {
return;
}
@@ -559,7 +604,7 @@ namespace SingularityGroup.HotReload.Editor {
}
GUILayout.Space(9f); // space between logo and headline
GUILayout.Label("Make changes to a build running on-device",
GUILayout.Label(Translations.OnDevice.OnDeviceHeadline,
headlineStyle, GUILayout.MinHeight(EditorGUIUtility.singleLineHeight * 1.4f));
// image showing how Hot Reload works with a phone
// var bannerBox = GUILayoutUtility.GetRect(flowchart.width * 0.6f, flowchart.height * 0.6f);
@@ -571,7 +616,7 @@ namespace SingularityGroup.HotReload.Editor {
//ButtonToOpenBuildSettings();
{
GUILayout.Label("Manual connect", HotReloadWindowStyles.H3TitleStyle);
GUILayout.Label(Translations.Settings.SettingsManualConnect, HotReloadWindowStyles.H3TitleStyle);
EditorGUILayout.Space();
GUILayout.BeginHorizontal();
@@ -583,22 +628,21 @@ namespace SingularityGroup.HotReload.Editor {
string text;
var ip = IpHelper.GetIpAddressCached();
if (string.IsNullOrEmpty(ip)) {
text = $"If auto-pair fails, find your local IP in OS settings, and use this format to connect: '{{ip}}:{RequestHelper.port}'";
text = string.Format(Translations.OnDevice.OnDeviceManualConnectFormat, RequestHelper.port);
} else {
text = $"If auto-pair fails, use this IP and port to connect: {ip}:{RequestHelper.port}" +
"\nMake sure you are on the same LAN/WiFi network";
text = string.Format(Translations.OnDevice.OnDeviceManualConnectWithIP, ip, RequestHelper.port);
}
GUILayout.Label(text, HotReloadWindowStyles.H3TitleWrapStyle);
if (!currentState.isServerHealthy) {
DrawHorizontalCheck(ServerHealthCheck.I.IsServerHealthy,
"Hot Reload is running",
"Hot Reload is not running",
Translations.OnDevice.OnDeviceCheckHotReloadRunning,
Translations.OnDevice.OnDeviceCheckHotReloadNotRunning,
hasFix: false);
}
if (!HotReloadPrefs.ExposeServerToLocalNetwork) {
var summary = $"Enable '{new ExposeServerOption().ShortSummary}'";
var summary = string.Format(Translations.OnDevice.OnDeviceCheckEnableExposeServer, new ExposeServerOption().ShortSummary);
DrawHorizontalCheck(HotReloadPrefs.ExposeServerToLocalNetwork,
summary,
summary);
@@ -620,10 +664,10 @@ namespace SingularityGroup.HotReload.Editor {
{
EditorGUILayout.BeginHorizontal();
GUILayout.Label("Build Settings Checklist", HotReloadWindowStyles.H3TitleStyle);
GUILayout.Label(Translations.Settings.SettingsBuildSettingsChecklist, HotReloadWindowStyles.H3TitleStyle);
EditorGUI.BeginDisabledGroup(isSupported);
// One-click to change each setting to the supported value
if (GUILayout.Button("Fix All", GUILayout.MaxWidth(90f))) {
if (GUILayout.Button(Translations.Common.ButtonFixAll, GUILayout.MaxWidth(90f))) {
FixAllUnsupportedSettings(so);
}
EditorGUI.EndDisabledGroup();
@@ -641,7 +685,7 @@ namespace SingularityGroup.HotReload.Editor {
// Settings checkboxes (Hot Reload options)
{
GUILayout.Label("Options", HotReloadWindowStyles.H3TitleStyle);
GUILayout.Label(Translations.Settings.SettingsOptions, HotReloadWindowStyles.H3TitleStyle);
if (settingsObject) {
optionsSection.DrawGUI(so);
}
@@ -655,7 +699,7 @@ namespace SingularityGroup.HotReload.Editor {
currentState.loginStatus,
verbose: true,
allowHide: false,
overrideActionButton: "Activate License",
overrideActionButton:Translations.Common.ButtonActivateLicense,
showConsumptions: true
);
}
@@ -731,12 +775,12 @@ namespace SingularityGroup.HotReload.Editor {
if (current == buildTarget) {
return true;
}
var confirmed = EditorUtility.DisplayDialog("Switch Build Target",
"Switching the build target can take a while depending on project size.",
$"Switch to Standalone", "Cancel");
var confirmed = EditorUtility.DisplayDialog(Translations.Dialogs.DialogTitleSwitchBuildTarget,
Translations.Dialogs.DialogMessageSwitchBuildTarget,
Translations.Dialogs.DialogButtonSwitchToStandalone, Translations.Common.ButtonCancel);
if (confirmed) {
EditorUserBuildSettings.SwitchActiveBuildTargetAsync(BuildTargetGroup.Standalone, buildTarget);
Log.Info($"Build target is switching to {buildTarget}.");
Log.Info(Translations.About.LogBuildTargetSwitching, buildTarget);
return true;
} else {
return false;
@@ -755,28 +799,28 @@ namespace SingularityGroup.HotReload.Editor {
isSupported = true;
var selectedPlatform = currentBuildTarget.Value;
DrawHorizontalCheck(isCurrentBuildTargetSupported.Value,
$"The {selectedPlatform.ToString()} platform is selected",
$"The current platform is {selectedPlatform.ToString()} which is not supported");
string.Format(Translations.OnDevice.OnDeviceCheckPlatformSelected, selectedPlatform.ToString()),
string.Format(Translations.OnDevice.OnDeviceCheckPlatformNotSupported, selectedPlatform.ToString()));
using (new EditorGUI.DisabledScope(!isCurrentBuildTargetSupported.Value)) {
foreach (var option in allOptions) {
DrawHorizontalCheck(option.GetValue(so),
$"Enable \"{option.ShortSummary}\"",
$"Enable \"{option.ShortSummary}\"");
string.Format(Translations.OnDevice.OnDeviceCheckEnableExposeServer, option.ShortSummary),
string.Format(Translations.OnDevice.OnDeviceCheckEnableExposeServer, option.ShortSummary));
}
DrawHorizontalCheck(EditorUserBuildSettings.development,
"Development Build is enabled",
"Enable \"Development Build\"");
Translations.OnDevice.OnDeviceCheckDevelopmentEnabled,
Translations.OnDevice.OnDeviceCheckEnableDevelopment);
DrawHorizontalCheck(ScriptingBackend == ScriptingImplementation.Mono2x,
$"Scripting Backend is set to Mono",
$"Set Scripting Backend to Mono");
Translations.OnDevice.OnDeviceCheckMonoBackend,
Translations.OnDevice.OnDeviceCheckSetMonoBackend);
DrawHorizontalCheck(StrippingLevel == ManagedStrippingLevel.Disabled,
$"Stripping Level = {StrippingLevel}",
$"Stripping Level = {StrippingLevel}",
suggestedSolutionText: "Code stripping needs to be disabled to ensure that all methods are available for patching."
string.Format(Translations.OnDevice.OnDeviceCheckStrippingLevel, StrippingLevel),
string.Format(Translations.OnDevice.OnDeviceCheckStrippingLevel, StrippingLevel),
suggestedSolutionText: Translations.OnDevice.OnDeviceCheckStrippingSolution
);
}
}