updated: hot reload to 1.13.7
This commit is contained in:
@@ -79,22 +79,30 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
|
||||
|
||||
// Get relative path
|
||||
TextAsset file = null;
|
||||
foreach (var path in supportedPaths) {
|
||||
int lastprojectIndex = 0;
|
||||
int attempt = 0;
|
||||
while (attempt++ < 100 && !file) {
|
||||
lastprojectIndex = errorString.IndexOf(path, lastprojectIndex + 1, StringComparison.Ordinal);
|
||||
if (lastprojectIndex == -1) {
|
||||
break;
|
||||
try {
|
||||
foreach (var path in supportedPaths) {
|
||||
int lastprojectIndex = 0;
|
||||
int attempt = 0;
|
||||
while (attempt++ < 100 && !file) {
|
||||
lastprojectIndex = errorString.IndexOf(path, lastprojectIndex + 1, StringComparison.Ordinal);
|
||||
if (lastprojectIndex == -1) {
|
||||
break;
|
||||
}
|
||||
var fullCsIndex = errorString.IndexOf(".cs", lastprojectIndex, StringComparison.Ordinal);
|
||||
var l = fullCsIndex - lastprojectIndex + ".cs".Length;
|
||||
if (l <= 0) {
|
||||
continue;
|
||||
}
|
||||
var candidateAbsolutePath = errorString.Substring(lastprojectIndex, fullCsIndex - lastprojectIndex + ".cs".Length);
|
||||
var candidateRelativePath = EditorCodePatcher.GetRelativePath(filespec: candidateAbsolutePath, folder: path);
|
||||
file = AssetDatabase.LoadAssetAtPath<TextAsset>(candidateRelativePath);
|
||||
}
|
||||
var fullCsIndex = errorString.IndexOf(".cs", lastprojectIndex, StringComparison.Ordinal);
|
||||
var candidateAbsolutePath = errorString.Substring(lastprojectIndex, fullCsIndex - lastprojectIndex + ".cs".Length);
|
||||
var candidateRelativePath = EditorCodePatcher.GetRelativePath(filespec: candidateAbsolutePath, folder: path);
|
||||
file = AssetDatabase.LoadAssetAtPath<TextAsset>(candidateRelativePath);
|
||||
}
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
|
||||
// Get the line number
|
||||
@@ -397,17 +405,14 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
GUI.Label(startRect, new GUIContent(title, icon), style);
|
||||
}
|
||||
|
||||
bool clickableDescription = alertEntry.title == "Unsupported change" || alertEntry.title == "Compile error" || alertEntry.title == "Failed applying patch to method";
|
||||
bool clickableDescription = (alertEntry.title == "Unsupported change" || alertEntry.title == "Compile error" || alertEntry.title == "Failed applying patch to method") && alertEntry.alertData.alertEntryType != AlertEntryType.InlinedMethod;
|
||||
|
||||
if (HotReloadTimelineHelper.expandedEntries.Contains(alertEntry) || alertEntry.alertType == AlertType.CompileError) {
|
||||
using (new EditorGUILayout.VerticalScope()) {
|
||||
using (new EditorGUILayout.HorizontalScope()) {
|
||||
using (new EditorGUILayout.VerticalScope(entryType == EntryType.Child ? HotReloadWindowStyles.ChildEntryBoxStyle : HotReloadWindowStyles.EntryBoxStyle)) {
|
||||
if (alertEntry.alertType == AlertType.Suggestion) {
|
||||
if (alertEntry.alertType == AlertType.Suggestion || !clickableDescription) {
|
||||
GUILayout.Label(alertEntry.description, HotReloadWindowStyles.LabelStyle);
|
||||
} else if (!clickableDescription) {
|
||||
string text = alertEntry.description;
|
||||
GUILayout.Label(text, HotReloadWindowStyles.LabelStyle);
|
||||
}
|
||||
if (alertEntry.actionData != null) {
|
||||
alertEntry.actionData.Invoke();
|
||||
@@ -659,18 +664,29 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
if (!firstDialoguePass) {
|
||||
return;
|
||||
}
|
||||
var secondDialoguePass = !Application.isPlaying
|
||||
|| EditorUtility.DisplayDialog(
|
||||
title: "Stop Play Mode and Recompile?",
|
||||
message: "Using the Recompile button will stop Play Mode.\n\nDo you wish to proceed?",
|
||||
ok: "Stop and Recompile",
|
||||
cancel: "Cancel");
|
||||
if (!secondDialoguePass) {
|
||||
if (!ConfirmExitPlaymode("Using the Recompile button will stop Play Mode.\n\nDo you wish to proceed?")) {
|
||||
return;
|
||||
}
|
||||
Recompile();
|
||||
}
|
||||
|
||||
#if UNITY_2020_1_OR_NEWER
|
||||
public static void SwitchToDebugMode() {
|
||||
CompilationPipeline.codeOptimization = CodeOptimization.Debug;
|
||||
HotReloadRunTab.Recompile();
|
||||
HotReloadSuggestionsHelper.SetSuggestionInactive(HotReloadSuggestionKind.SwitchToDebugModeForInlinedMethods);
|
||||
}
|
||||
#endif
|
||||
|
||||
public static bool ConfirmExitPlaymode(string message) {
|
||||
return !Application.isPlaying
|
||||
|| EditorUtility.DisplayDialog(
|
||||
title: "Stop Play Mode and Recompile?",
|
||||
message: message,
|
||||
ok: "Stop and Recompile",
|
||||
cancel: "Cancel");
|
||||
}
|
||||
|
||||
public static bool recompiling;
|
||||
public static void Recompile() {
|
||||
recompiling = true;
|
||||
@@ -697,7 +713,7 @@ namespace SingularityGroup.HotReload.Editor {
|
||||
EditorCodePatcher.DownloadAndRun().Forget();
|
||||
}
|
||||
} else if (currentState.running && !currentState.starting) {
|
||||
if (HotReloadWindowStyles.windowScreenWidth > 150 && HotReloadTimelineHelper.CompileErrorsCount == 0) {
|
||||
if (HotReloadWindowStyles.windowScreenWidth > 150) {
|
||||
RenderRecompileButton();
|
||||
}
|
||||
string stopText = HotReloadWindowStyles.windowScreenWidth > Constants.StartButtonTextHideWidth ? " Stop" : "";
|
||||
|
||||
Reference in New Issue
Block a user