From 19d627592d07b6c424a3160be77428fc63281284 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Tue, 12 Sep 2023 21:00:28 +0200 Subject: [PATCH] [unity] Fixed mask material generation issuing incorrect warnings when only animation sets visible attachments. Applying initial animation before mask material generation. Closes #2363. --- .../spine-unity/Editor/Utility/SpineEditorUtilities.cs | 6 ++++++ .../Editor/spine-unity/Editor/Utility/SpineMaskUtilities.cs | 2 +- spine-unity/Assets/Spine/package.json | 2 +- 3 files changed, 8 insertions(+), 2 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 da6915633..95d69a951 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 @@ -310,6 +310,12 @@ namespace Spine.Unity.Editor { if (oldAnimationState != null) { stateComponent.AnimationState.AssignEventSubscribersFrom(oldAnimationState); } + if (stateComponent != null) { + // Any set animation needs to be applied as well since it might set attachments, + // having an effect on generated SpriteMaskMaterials below. + stateComponent.AnimationState.Apply(component.skeleton); + component.LateUpdate(); + } #if BUILT_IN_SPRITE_MASK_COMPONENT SpineMaskUtilities.EditorAssignSpriteMaskMaterials(component); diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineMaskUtilities.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineMaskUtilities.cs index 494357c9b..80ddec995 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineMaskUtilities.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineMaskUtilities.cs @@ -176,7 +176,7 @@ namespace Spine.Unity.Editor { Material[] currentMaterials = meshRenderer.sharedMaterials; if (currentMaterials.Length == 0 || currentMaterials[0] == null) { - Debug.LogWarning("No materials found assigned at " + skeleton.name); + // Note: if no attachments are visible, no materials are set. This is a valid state. return false; } diff --git a/spine-unity/Assets/Spine/package.json b/spine-unity/Assets/Spine/package.json index eea73d71c..755ff2f0d 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.1.22", + "version": "4.1.23", "unity": "2018.3", "author": { "name": "Esoteric Software",