From be983ac413d97f8288451f2740be36753e0afb29 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Wed, 8 Feb 2023 20:05:50 +0100 Subject: [PATCH 1/2] [unity] Fixed `Atlas source cannot be null!` upon jpg import in Unity 2022.2. Closes #2237. --- .../Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs index 2ea058944..2261ec2b9 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs @@ -497,7 +497,7 @@ namespace Spine.Unity.Editor { static void AddDependentAtlasIfImageChanged (List atlasPaths, List imagePaths) { foreach (string imagePath in imagePaths) { - string atlasPath = imagePath.Replace(".png", ".atlas.txt"); + string atlasPath = Path.ChangeExtension(imagePath, ".atlas.txt"); if (!System.IO.File.Exists(atlasPath)) continue; From bf5d445fa74f6e6f7d104a17ac441c43a812ed42 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Thu, 9 Feb 2023 16:55:48 +0100 Subject: [PATCH 2/2] [unity] Fixed IndexOutOfRangeException on Unity 2022.2 upon first project import or upgrade. Closes #2241. --- .../Editor/Utility/SpineEditorUtilities.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs index a6d258e8f..f5a080064 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineEditorUtilities.cs @@ -173,17 +173,22 @@ namespace Spine.Unity.Editor { if (EditorApplication.isPlayingOrWillChangePlaymode) return; string[] folders = { "Assets", "Packages" }; - string[] assets = AssetDatabase.FindAssets("t:script SpineEditorUtilities", folders); - string assetPath = AssetDatabase.GUIDToAssetPath(assets[0]); - editorPath = Path.GetDirectoryName(assetPath).Replace('\\', '/'); - + string[] assets; + string assetPath; assets = AssetDatabase.FindAssets("t:texture icon-subMeshRenderer", folders); if (assets.Length > 0) { assetPath = AssetDatabase.GUIDToAssetPath(assets[0]); editorGUIPath = Path.GetDirectoryName(assetPath).Replace('\\', '/'); - } else { - editorGUIPath = editorPath.Replace("/Utility", "/GUI"); } + assets = AssetDatabase.FindAssets("t:script SpineEditorUtilities", folders); + if (assets.Length > 0) { + assetPath = AssetDatabase.GUIDToAssetPath(assets[0]); + editorPath = Path.GetDirectoryName(assetPath).Replace('\\', '/'); + if (string.IsNullOrEmpty(editorGUIPath)) + editorGUIPath = editorPath.Replace("/Utility", "/GUI"); + } + if (string.IsNullOrEmpty(editorGUIPath)) + return; Icons.Initialize(); // Drag and Drop