[Add] Hot Reload

This commit is contained in:
2026-02-27 03:16:18 +07:00
parent 5067cb51a1
commit b37579153b
431 changed files with 43054 additions and 1 deletions
@@ -0,0 +1,31 @@
using System;
using System.IO;
namespace SingularityGroup.HotReload {
// Largely copied from CommandLineParameters.ReadIsClone of UnityEditor.MultiplayerModule.dll
internal static class MultiplayerPlaymodeHelper {
#if UNITY_EDITOR && UNITY_2023_1_OR_NEWER
public static bool? isClone;
public static bool IsClone => isClone == null ? (isClone = HasCommandLineArgument(Environment.GetCommandLineArgs(), "--virtual-project-clone")).Value : isClone.Value;
#else
public static bool IsClone => false;
#endif
public static bool HasCommandLineArgument(string[] commandLineArgs, string argumentName) {
foreach (string commandLineArg in commandLineArgs) {
if (commandLineArg == argumentName) {
return true;
}
}
return false;
}
public static string PathToMainProject(string path) {
if (IsClone) {
// Library/VP/<clone-id> is the base path
return Path.Combine("..", "..", "..", path);
}
return path;
}
}
}