Update HotReload

This commit is contained in:
2026-03-28 12:54:41 +07:00
parent f2173d2c73
commit a4f2654d0b
278 changed files with 2027 additions and 1896 deletions
@@ -5,10 +5,34 @@ using System.Text;
using SingularityGroup.HotReload.Newtonsoft.Json;
using UnityEngine;
using System;
using SingularityGroup.HotReload.DTO;
using SingularityGroup.HotReload.Localization;
namespace SingularityGroup.HotReload.Editor.Cli {
internal static class CliUtils {
static readonly string projectIdentifier = GetProjectIdentifier();
class Config {
public bool singleInstance;
}
public static string GetProjectIdentifier() {
if (File.Exists(PackageConst.ConfigFilePath)) {
var config = JsonConvert.DeserializeObject<Config>(File.ReadAllText(PackageConst.ConfigFilePath));
if (config.singleInstance) {
return null;
}
}
var path = Path.GetFullPath(MultiplayerPlaymodeHelper.PathToMainProject("."));
var name = new DirectoryInfo(path).Name;
using (SHA256 sha256 = SHA256.Create()) {
byte[] inputBytes = Encoding.UTF8.GetBytes(path);
byte[] hashBytes = sha256.ComputeHash(inputBytes);
var hash = BitConverter.ToString(hashBytes).Replace("-", "").Substring(0, 6).ToUpper();
return $"{name}-{hash}";
}
}
public static string GetTempDownloadFilePath(string osxFileName) {
if (UnityHelper.Platform == RuntimePlatform.OSXEditor) {
// project specific temp directory that is writeable on MacOS (Path.GetTempPath() wasn't when run through HotReload.app)
@@ -19,6 +43,16 @@ namespace SingularityGroup.HotReload.Editor.Cli {
}
public static string GetHotReloadTempDir() {
if (UnityHelper.Platform == RuntimePlatform.WindowsEditor) {
// library path interfereces with VS Code file watcher (Source Control window doesn't auto refresh)
// so we pick data path on windows instead
if (projectIdentifier != null) {
return Path.Combine(GetAppDataPath(), "HotReloadServerTemp", projectIdentifier);
} else {
return Path.Combine(GetAppDataPath(), "HotReloadServerTemp");
}
}
// store in library path on mac and linux since it works there
return Path.GetFullPath(Path.Combine(PackageConst.LibraryCachePath, "HotReloadServerTemp"));
}
@@ -1,10 +1,3 @@
fileFormatVersion: 2
guid: b0243b348dec4a308dc7b98e09842d2c
timeCreated: 1673820875
AssetOrigin:
serializedVersion: 1
productId: 254358
packageName: Hot Reload | Edit Code Without Compiling
packageVersion: 1.13.17
assetPath: Packages/com.singularitygroup.hotreload/Editor/CLI/CliUtils.cs
uploadId: 870414
timeCreated: 1673820875
@@ -1,10 +1,3 @@
fileFormatVersion: 2
guid: 090ed5d45f294f0d8799879206139bd6
timeCreated: 1673824275
AssetOrigin:
serializedVersion: 1
productId: 254358
packageName: Hot Reload | Edit Code Without Compiling
packageVersion: 1.13.17
assetPath: Packages/com.singularitygroup.hotreload/Editor/CLI/FallbackCliController.cs
uploadId: 870414
timeCreated: 1673824275
@@ -166,7 +166,7 @@ namespace SingularityGroup.HotReload.Editor.Cli {
}
var searchAssemblies = string.Join(";", CodePatcher.I.GetAssemblySearchPaths());
var cliArguments = $@"-u ""{unityProjDir}"" -s ""{slnPath}"" -t ""{cliTempDir}"" -a ""{searchAssemblies}"" -ver ""{PackageConst.Version}"" -proc ""{Process.GetCurrentProcess().Id}"" -assets ""{allAssetChanges}"" -p ""{port}"" -r {isReleaseMode} -detailed-error-reporting {detailedErrorReporting}";
var cliArguments = $@"-u ""{unityProjDir}"" -s ""{slnPath}"" -t ""{cliTempDir}"" -a ""{searchAssemblies}"" -ver ""{PackageConst.Version}"" -proc ""{Process.GetCurrentProcess().Id}"" -assets ""{allAssetChanges}"" -p ""{port}"" -r {isReleaseMode} -detailed-error-reporting {detailedErrorReporting} -default-locale {PackageConst.DefaultLocale}";
if (loginData != null) {
cliArguments += $@" -email ""{loginData.email}"" -pass ""{loginData.password}""";
}
@@ -1,10 +1,3 @@
fileFormatVersion: 2
guid: 9f756ed6b78d428b8b9f83a6544317fe
timeCreated: 1673820326
AssetOrigin:
serializedVersion: 1
productId: 254358
packageName: Hot Reload | Edit Code Without Compiling
packageVersion: 1.13.17
assetPath: Packages/com.singularitygroup.hotreload/Editor/CLI/HotReloadCli.cs
uploadId: 870414
timeCreated: 1673820326
@@ -1,10 +1,3 @@
fileFormatVersion: 2
guid: 8cba48e21f76483da3ba615915e731fd
timeCreated: 1673820542
AssetOrigin:
serializedVersion: 1
productId: 254358
packageName: Hot Reload | Edit Code Without Compiling
packageVersion: 1.13.17
assetPath: Packages/com.singularitygroup.hotreload/Editor/CLI/ICliController.cs
uploadId: 870414
timeCreated: 1673820542
@@ -1,10 +1,3 @@
fileFormatVersion: 2
guid: c894a69d595d4ada8cfa4afe23c68ab9
timeCreated: 1673820131
AssetOrigin:
serializedVersion: 1
productId: 254358
packageName: Hot Reload | Edit Code Without Compiling
packageVersion: 1.13.17
assetPath: Packages/com.singularitygroup.hotreload/Editor/CLI/LinuxCliController.cs
uploadId: 870414
timeCreated: 1673820131
@@ -1,10 +1,3 @@
fileFormatVersion: 2
guid: 5ebeed1c29454bc78e5a9ee64f2c9def
timeCreated: 1673821666
AssetOrigin:
serializedVersion: 1
productId: 254358
packageName: Hot Reload | Edit Code Without Compiling
packageVersion: 1.13.17
assetPath: Packages/com.singularitygroup.hotreload/Editor/CLI/OsxCliController.cs
uploadId: 870414
timeCreated: 1673821666
@@ -9,10 +9,3 @@ MonoImporter:
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 254358
packageName: Hot Reload | Edit Code Without Compiling
packageVersion: 1.13.17
assetPath: Packages/com.singularitygroup.hotreload/Editor/CLI/StartArgs.cs
uploadId: 870414
@@ -1,10 +1,3 @@
fileFormatVersion: 2
guid: e5644af69ec7404a8039ff2833610d48
timeCreated: 1673822169
AssetOrigin:
serializedVersion: 1
productId: 254358
packageName: Hot Reload | Edit Code Without Compiling
packageVersion: 1.13.17
assetPath: Packages/com.singularitygroup.hotreload/Editor/CLI/WindowsCliController.cs
uploadId: 870414
timeCreated: 1673822169