Skip to content

Commit 39aa7c2

Browse files
committed
v1.1.14
1 parent b0bc1e4 commit 39aa7c2

File tree

7 files changed

+52
-7
lines changed

7 files changed

+52
-7
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
# 1.1.13
1+
# 1.1.14
2+
3+
- Better messages for dialogues
4+
- Configs menu for easier asset focusing
5+
- Added configs to `Tools > Unity Project Patcher > Configs`
6+
- Won't show log for package not needing an upgrade
7+
8+
# 1.1.13
29

310
- Added asset replacement utility
411
- Added option to update packages in tool window itself

Editor/PatcherUtility.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,14 @@ public static bool HasDomainReloadingDisabled() {
595595
return false;
596596
}
597597

598+
[MenuItem("Tools/Unity Project Patcher/Configs/" + nameof(UPPatcherUserSettings))]
599+
private static void OpenUPPatcherUserSettings() {
600+
var config = GetUserSettings();
601+
EditorUtility.FocusProjectWindow();
602+
Selection.activeObject = config;
603+
EditorGUIUtility.PingObject(config);
604+
}
605+
598606
// #if UNITY_EDITOR_WIN
599607
// [DllImport("user32.dll")]
600608
// public static extern bool SetForegroundWindow(IntPtr hWnd);

Editor/PatcherWindow.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ private static IEnumerable<PackageVersion> GetPackageVersions() {
9696
if (currentToolVersion != toolVersion) {
9797
Debug.LogWarning($"[com.nomnom.unity-project-patcher] is <color=yellow>outdated</color>. Please update to {toolVersion} from \"{toolGit}\". Current version: {currentToolVersion}.");
9898
} else {
99-
Debug.Log($"[com.nomnom.unity-project-patcher] is up to date. Current version: {currentToolVersion}.");
99+
//Debug.Log($"[com.nomnom.unity-project-patcher] is up to date. Current version: {currentToolVersion}.");
100100
}
101101
} else {
102102
Debug.LogWarning($"Failed to fetch [com.nomnom.unity-project-patcher] version from \"{toolGit}\".");
@@ -111,7 +111,7 @@ private static IEnumerable<PackageVersion> GetPackageVersions() {
111111
if (currentBepInExVersion != bepinexVersion) {
112112
Debug.LogWarning($"[com.nomnom.unity-project-patcher-bepinex] is <color=yellow>outdated</color>. Please update to {bepinexVersion} from \"{bepinexGit}\". Current version: {currentBepInExVersion}.");
113113
} else {
114-
Debug.Log($"[com.nomnom.unity-project-patcher-bepinex] is up to date. Current version: {currentBepInExVersion}.");
114+
//Debug.Log($"[com.nomnom.unity-project-patcher-bepinex] is up to date. Current version: {currentBepInExVersion}.");
115115
}
116116
} else {
117117
Debug.LogWarning($"Failed to fetch [com.nomnom.unity-project-patcher-bepinex] version from \"{bepinexGit}\".");
@@ -135,7 +135,7 @@ private static IEnumerable<PackageVersion> GetPackageVersions() {
135135
if (currentGameVersion != gameVersion) {
136136
Debug.LogWarning($"[{gamePackage.name}] is <color=yellow>outdated</color>. Please update to {gameVersion} from \"{gameGit}\". Current version: {currentGameVersion}.");
137137
} else {
138-
Debug.Log($"[{gamePackage.name}] is up to date. Current version: {currentGameVersion}.");
138+
//Debug.Log($"[{gamePackage.name}] is up to date. Current version: {currentGameVersion}.");
139139
}
140140
} else {
141141
Debug.LogWarning($"Failed to fetch [{gamePackage.name}] version from \"{gameGit}\".");
@@ -194,6 +194,7 @@ private void OnGUI() {
194194
}
195195

196196
EditorGUILayout.LabelField("All config assets will be made at the root of your project by default!", EditorStyles.centeredGreyMiniLabel);
197+
EditorGUILayout.LabelField("Configs can be focused via \"Tools > Unity Project Patcher > Configs\"", EditorStyles.centeredGreyMiniLabel);
197198

198199
var currentStep = StepsExecutor.CurrentStepName;
199200
GUI.enabled = string.IsNullOrEmpty(currentStep);
@@ -221,7 +222,7 @@ private void OnGUI() {
221222

222223
try {
223224
if (string.IsNullOrEmpty(userSettings.GameFolderPath) || !Directory.Exists(Path.GetFullPath(userSettings.GameFolderPath))) {
224-
EditorUtility.DisplayDialog("Error", "Please select a valid game folder!\n\nPlease fix this in your UPPatcherUserSettings asset!", "Focus UPPatcherUserSettings");
225+
EditorUtility.DisplayDialog("Error", "Please select a valid game folder!\n\nPlease fix this in your UPPatcherUserSettings asset!\n\n" + @"This path is absolute to your game folder. Such as: ""C:\Program Files (x86)\Steam\steamapps\common\Lethal Company""", "Focus UPPatcherUserSettings");
225226
EditorUtility.FocusProjectWindow();
226227
Selection.activeObject = userSettings;
227228
EditorGUIUtility.PingObject(userSettings);
@@ -258,10 +259,16 @@ private void OnGUI() {
258259

259260
if (PatcherUtility.IsProbablyPatched()) {
260261
if (!EditorUtility.DisplayDialog("Warning", "The project seems to already be patched. Are you sure you want to continue? This may lead to unrecoverable changes.\n\nMake sure you back up your project before doing this!", "Yes", "No")) {
262+
Debug.LogWarning("Patcher stopped early");
261263
return;
262264
}
263265
}
264266

267+
if (!EditorUtility.DisplayDialog("Note", "The patcher will take a while to complete. It will also restart multiple times.\n\nDo not touch Unity unless a popup shows up for an error, the patcher completing, or another reason.", "OK")) {
268+
Debug.LogWarning("Patcher stopped early");
269+
return;
270+
}
271+
265272
EditorApplication.delayCall += () => {
266273
PatcherSteps.Run();
267274
};

Editor/Steps/Processing/PackagesInstallerStep.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public UniTask<StepResult> Run() {
5555
return UniTask.FromResult(StepResult.Success);
5656
}
5757

58-
EditorUtility.DisplayDialog("Installing packages", $"The following packages are missing: {string.Join(", ", missingPackages)}", "OK");
58+
EditorUtility.DisplayDialog("Installing packages", $"Press \"OK\" to install the following packages: {string.Join(", ", missingPackages)}", "OK");
5959
EditorUtility.DisplayProgressBar("Installing packages", $"Installing {missingPackages.Length} package{(missingPackages.Length == 1 ? string.Empty : "s")}", 0.5f);
6060

6161
#if UNITY_2020_3_OR_NEWER

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ The tool window can be opened via `Tools > Unity Project Patcher > Open Window`
145145
> This tool mostly supports patching an already patched project, although this can lead to broken assets.
146146
> So make sure you back up your project beforehand.
147147
148+
When pressing the patch button, it may prompt you to fix various paths in your `UPPatcherUserSettings` asset.
149+
150+
Available configs can be accessed via `Tools > Unity Project Patcher > Configs`
151+
148152
### Patcher Configs
149153

150154
### UPPatcherUserSettings

Runtime/PatcherUtility.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,25 @@ public static string ToOSPath(this string path) {
2222
}
2323

2424
#if UNITY_EDITOR
25+
public static T GetSettingsAsset<T>() where T : ScriptableObject {
26+
var assets = AssetDatabase.FindAssets($"t:{nameof(T)}");
27+
if (assets.Length == 0) {
28+
CreateSettings<T>();
29+
Debug.LogWarning($"Created {nameof(T)} asset since it was missing");
30+
assets = AssetDatabase.FindAssets($"t:{nameof(T)}");
31+
}
32+
33+
var assetPath = AssetDatabase.GUIDToAssetPath(assets[0]);
34+
return AssetDatabase.LoadAssetAtPath<T>(assetPath);
35+
}
36+
37+
public static void CreateSettings<T>() where T : ScriptableObject {
38+
var settings = ScriptableObject.CreateInstance<T>();
39+
AssetDatabase.CreateAsset(settings, $"Assets/{nameof(T)}.asset");
40+
AssetDatabase.SaveAssets();
41+
AssetDatabase.Refresh();
42+
}
43+
2544
public static UPPatcherUserSettings GetUserSettings() {
2645
var assets = AssetDatabase.FindAssets($"t:{nameof(UPPatcherUserSettings)}");
2746
if (assets.Length == 0) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.nomnom.unity-project-patcher",
3-
"version": "1.1.13",
3+
"version": "1.1.14",
44
"displayName": "Unity Project Patcher",
55
"description": "A tool that generates a Unity project from a game build that can be playable in-editor",
66
"unity": "2022.3",

0 commit comments

Comments
 (0)