From 3a437b79b09bd0b07d1581d616610ba53116ecaa Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Fri, 22 Jan 2021 16:55:07 +0100 Subject: [PATCH 1/2] [unity] Minor cosmetic change: moved Spine Preferences window `Additive Material` line up to maintain same order as in SkeletonDataAsset. --- .../spine-unity/Editor/Utility/Preferences.cs | 14 +++++++------- .../spine-unity/Editor/Windows/SpinePreferences.cs | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/Preferences.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/Preferences.cs index 6d13c6fc9..def876116 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/Preferences.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/Preferences.cs @@ -276,6 +276,13 @@ namespace Spine.Unity.Editor { } } + SpineEditorUtilities.MaterialPrefsField(ref blendModeMaterialAdditive, BLEND_MODE_MATERIAL_ADDITIVE_KEY, new GUIContent("Additive Material", "Additive blend mode Material template.")); + if (string.IsNullOrEmpty(blendModeMaterialAdditive)) { + var blendModeMaterialAdditiveGUIDS = AssetDatabase.FindAssets(DEFAULT_BLEND_MODE_ADDITIVE_MATERIAL); + if (blendModeMaterialAdditiveGUIDS.Length > 0) { + blendModeMaterialAdditive = AssetDatabase.GUIDToAssetPath(blendModeMaterialAdditiveGUIDS[0]); + } + } SpineEditorUtilities.MaterialPrefsField(ref blendModeMaterialMultiply, BLEND_MODE_MATERIAL_MULTIPLY_KEY, new GUIContent("Multiply Material", "Multiply blend mode Material template.")); if (string.IsNullOrEmpty(blendModeMaterialMultiply)) { var blendModeMaterialMultiplyGUIDS = AssetDatabase.FindAssets(DEFAULT_BLEND_MODE_MULTIPLY_MATERIAL); @@ -290,13 +297,6 @@ namespace Spine.Unity.Editor { blendModeMaterialScreen = AssetDatabase.GUIDToAssetPath(blendModeMaterialScreenGUIDS[0]); } } - SpineEditorUtilities.MaterialPrefsField(ref blendModeMaterialAdditive, BLEND_MODE_MATERIAL_ADDITIVE_KEY, new GUIContent("Additive Material", "Additive blend mode Material template.")); - if (string.IsNullOrEmpty(blendModeMaterialAdditive)) { - var blendModeMaterialAdditiveGUIDS = AssetDatabase.FindAssets(DEFAULT_BLEND_MODE_ADDITIVE_MATERIAL); - if (blendModeMaterialAdditiveGUIDS.Length > 0) { - blendModeMaterialAdditive = AssetDatabase.GUIDToAssetPath(blendModeMaterialAdditiveGUIDS[0]); - } - } } EditorGUILayout.Space(); diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/SpinePreferences.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/SpinePreferences.cs index 98ebe9f7b..a8469d22d 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/SpinePreferences.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/SpinePreferences.cs @@ -240,9 +240,9 @@ namespace Spine.Unity.Editor { } } + EditorGUILayout.PropertyField(settings.FindProperty("blendModeMaterialAdditive"), new GUIContent("Additive Material", "Additive blend mode Material template.")); EditorGUILayout.PropertyField(settings.FindProperty("blendModeMaterialMultiply"), new GUIContent("Multiply Material", "Multiply blend mode Material template.")); EditorGUILayout.PropertyField(settings.FindProperty("blendModeMaterialScreen"), new GUIContent("Screen Material", "Screen blend mode Material template.")); - EditorGUILayout.PropertyField(settings.FindProperty("blendModeMaterialAdditive"), new GUIContent("Additive Material", "Additive blend mode Material template.")); } EditorGUILayout.Space(); From 48470a4b1634c99cb245e6ba15f1f937e949a1a1 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Fri, 29 Jan 2021 13:07:22 +0100 Subject: [PATCH 2/2] [unity] Fixed two minor reported issues (could not be reproduced by user). Now officially supporting Unity versions 2020.1 and 2020.2 with this commit. Closes #1835. --- CHANGELOG.md | 2 +- .../Scripts/Sample Components/Ghost/SkeletonGhost.cs | 2 +- .../spine-unity/Editor/Components/SkeletonAnimationInspector.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e914577e..a86982e75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -140,7 +140,7 @@ ### Unity * **Breaking changes** - * **Officially supported Unity versions are 2017.1-2019.4**. + * **Officially supported Unity versions are 2017.1-2020.2**. * **Spine `.asmdef` files are again active by default**. They have previously been deactivated to `.txt` extension which is now no longer necessary. * **Removed PoseSkeleton() and PoseWithAnimation()** extension methods to prevent issues where animations are not mixed out. Problem was that these methods did not set AnimationState, leaving incorrect state at e.g. attachments enabled at slots when starting subsequent animations. As a replacement you can use `AnimationState.ClearTrack(0);` followed by `var entry = AnimationState.SetAnimation(0, animation, loop); entry.TrackTime = time` to achieve similar behaviour. * **The `Shadow alpha cutoff` shader parameter is now respecting slot-color alpha** values at all Spine shaders. A fragment's texture color alpha is multiplied with slot-color alpha before the result is tested against the `Shadow alpha cutoff` threshold. diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/Ghost/SkeletonGhost.cs b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/Ghost/SkeletonGhost.cs index dde14f2f3..2c81dd39f 100644 --- a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/Ghost/SkeletonGhost.cs +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/Ghost/SkeletonGhost.cs @@ -122,7 +122,7 @@ namespace Spine.Unity.Examples { } void Update () { - if (!ghostingEnabled) + if (!ghostingEnabled || poolIndex >= pool.Length) return; if (Time.time >= nextSpawnTime) { diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonAnimationInspector.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonAnimationInspector.cs index ac91bd41f..f0282a78d 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonAnimationInspector.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonAnimationInspector.cs @@ -119,7 +119,7 @@ namespace Spine.Unity.Editor { // Reflect animationName serialized property in the inspector even if SetAnimation API was used. if (Application.isPlaying) { - if (current != null) { + if (current != null && current.Animation != null) { if (skeletonAnimation.AnimationName != animationName.stringValue) animationName.stringValue = current.Animation.Name; }