From 11c0bf8bbeca637e2e629bfd201ba117b73e9605 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Thu, 4 Apr 2024 20:38:22 +0200 Subject: [PATCH] [unity] Fixed Parallel Import not applying preset atlas texture settings. Closes #2496. --- .../Editor/Utility/SpineEditorUtilities.cs | 14 ++++++++++++++ spine-unity/Assets/Spine/package.json | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) 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 86a63a79f..3e1f3aab3 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 @@ -75,6 +75,10 @@ namespace Spine.Unity.Editor { public static bool initialized; private static List texturesWithoutMetaFile = new List(); + public static void OnTextureImportedFirstTime (string texturePath) { + texturesWithoutMetaFile.Add(texturePath); + } + // Auto-import entry point for textures void OnPreprocessTexture () { #if UNITY_2018_1_OR_NEWER @@ -546,6 +550,16 @@ namespace Spine.Unity.Editor { } } + public class SpineAssetModificationProcessor : UnityEditor.AssetModificationProcessor { + static void OnWillCreateAsset (string assetName) { + // Note: This method seems to be called from the main thread, + // not from worker threads when Project Settings - Editor - Parallel Import is enabled. + int endIndex = assetName.LastIndexOf(".meta"); + string assetPath = endIndex < 0 ? assetName : assetName.Substring(0, endIndex); + SpineEditorUtilities.OnTextureImportedFirstTime(assetPath); + } + } + public class TextureModificationWarningProcessor : UnityEditor.AssetModificationProcessor { static string[] OnWillSaveAssets (string[] paths) { if (SpineEditorUtilities.Preferences.textureImporterWarning) { diff --git a/spine-unity/Assets/Spine/package.json b/spine-unity/Assets/Spine/package.json index 9ee55fec3..6a924014c 100644 --- a/spine-unity/Assets/Spine/package.json +++ b/spine-unity/Assets/Spine/package.json @@ -2,7 +2,7 @@ "name": "com.esotericsoftware.spine.spine-unity", "displayName": "spine-unity Runtime", "description": "This plugin provides the spine-unity runtime core.", - "version": "4.2.59", + "version": "4.2.60", "unity": "2018.3", "author": { "name": "Esoteric Software",