[unity][4.3-beta] Fixed mask interaction not being updated at runtime. Breaking change: maskInteraction -> MaskInteraction. Closes #2962.

This commit is contained in:
Harald Csaszar 2025-10-28 17:23:42 +01:00
parent 42da98a3dd
commit 4d076ba430
5 changed files with 21 additions and 10 deletions

View File

@ -347,6 +347,7 @@
- Spine Physics: `UpdateWorldTransform(Skeleton.Physics.Update)``UpdateWorldTransform(Spine.Physics.Update)` - Spine Physics: `UpdateWorldTransform(Skeleton.Physics.Update)``UpdateWorldTransform(Spine.Physics.Update)`
- UnityEngine Physics: `Physics.gravity``UnityEngine.Physics.gravity`. - UnityEngine Physics: `Physics.gravity``UnityEngine.Physics.gravity`.
- When enabling `Threaded Animation` at `SkeletonAnimation` components, `SkeletonAnimation.AnimationState` callbacks and `TrackEntry` callbacks are not automatically called on the main thread. There are additional main thread callbacks provided to subscribe to instead, like `MainThreadComplete` for `Complete` and the like - see *Additions* below. Please note that this requires a change of user code to subscribe to these main thread delegate variants instead. - When enabling `Threaded Animation` at `SkeletonAnimation` components, `SkeletonAnimation.AnimationState` callbacks and `TrackEntry` callbacks are not automatically called on the main thread. There are additional main thread callbacks provided to subscribe to instead, like `MainThreadComplete` for `Complete` and the like - see *Additions* below. Please note that this requires a change of user code to subscribe to these main thread delegate variants instead.
- `SkeletonRenderer`: `maskInteraction``MaskInteraction`.
- **Changes of default values** - **Changes of default values**
- Changed default atlas texture workflow from PMA to straight alpha textures. This move was done because straight alpha textures are compatible with both Gamma and Linear color space, with the latter being the default for quite some time now in Unity. Note that `PMA Vertex Color` is unaffected and shall be enabled as usual to allow for single-pass additive rendering. - Changed default atlas texture workflow from PMA to straight alpha textures. This move was done because straight alpha textures are compatible with both Gamma and Linear color space, with the latter being the default for quite some time now in Unity. Note that `PMA Vertex Color` is unaffected and shall be enabled as usual to allow for single-pass additive rendering.

View File

@ -104,7 +104,7 @@ namespace Spine.Unity.Editor {
} }
public static void EditorSetupSpriteMaskMaterials (SkeletonRenderer skeleton) { public static void EditorSetupSpriteMaskMaterials (SkeletonRenderer skeleton) {
SpriteMaskInteraction maskInteraction = skeleton.maskInteraction; SpriteMaskInteraction maskInteraction = skeleton.MaskInteraction;
if (maskInteraction == SpriteMaskInteraction.VisibleInsideMask) { if (maskInteraction == SpriteMaskInteraction.VisibleInsideMask) {
if (skeleton.insideMaskMaterials == null) if (skeleton.insideMaskMaterials == null)
EditorInitSpriteMaskMaterialsInsideMask(skeleton); EditorInitSpriteMaskMaterialsInsideMask(skeleton);

View File

@ -492,7 +492,7 @@ namespace Spine.Unity {
skeletonRenderer.clearStateOnDisable = this.clearStateOnDisableDeprecated; skeletonRenderer.clearStateOnDisable = this.clearStateOnDisableDeprecated;
skeletonRenderer.singleSubmesh = this.singleSubmeshDeprecated; skeletonRenderer.singleSubmesh = this.singleSubmeshDeprecated;
skeletonRenderer.maskInteraction = this.maskInteractionDeprecated; skeletonRenderer.MaskInteraction = this.maskInteractionDeprecated;
} }
[SerializeField] protected bool wasDeprecatedTransferred = false; [SerializeField] protected bool wasDeprecatedTransferred = false;

View File

@ -164,7 +164,7 @@ namespace Spine.Unity {
skeletonRenderer.clearStateOnDisable = this.clearStateOnDisableDeprecated; skeletonRenderer.clearStateOnDisable = this.clearStateOnDisableDeprecated;
skeletonRenderer.singleSubmesh = this.singleSubmeshDeprecated; skeletonRenderer.singleSubmesh = this.singleSubmeshDeprecated;
skeletonRenderer.maskInteraction = this.maskInteractionDeprecated; skeletonRenderer.MaskInteraction = this.maskInteractionDeprecated;
} }
[SerializeField] protected bool wasDeprecatedTransferred = false; [SerializeField] protected bool wasDeprecatedTransferred = false;

View File

@ -118,10 +118,8 @@ namespace Spine.Unity {
#endif #endif
#if BUILT_IN_SPRITE_MASK_COMPONENT #if BUILT_IN_SPRITE_MASK_COMPONENT
/// <summary>This enum controls the mode under which the sprite will interact with the masking system.</summary> /// <seealso cref="MaskInteraction"/>
/// <remarks>Interaction modes with <see cref="UnityEngine.SpriteMask"/> components are identical to Unity's <see cref="UnityEngine.SpriteRenderer"/>, protected SpriteMaskInteraction maskInteraction = SpriteMaskInteraction.None;
/// see https://docs.unity3d.com/ScriptReference/SpriteMaskInteraction.html. </remarks>
public SpriteMaskInteraction maskInteraction = SpriteMaskInteraction.None;
/// <summary>Cached reference to the already setup material override set at the respective /// <summary>Cached reference to the already setup material override set at the respective
/// SkeletonDataAsset.atlasAssets array entry.</summary> /// SkeletonDataAsset.atlasAssets array entry.</summary>
@ -160,6 +158,19 @@ namespace Spine.Unity {
#region Properties #region Properties
#region General Properties #region General Properties
#if BUILT_IN_SPRITE_MASK_COMPONENT
/// <summary>This enum controls the mode under which the sprite will interact with the masking system.</summary>
/// <remarks>Interaction modes with <see cref="UnityEngine.SpriteMask"/> components are identical to Unity's <see cref="UnityEngine.SpriteRenderer"/>,
/// see https://docs.unity3d.com/ScriptReference/SpriteMaskInteraction.html. </remarks>
public SpriteMaskInteraction MaskInteraction {
set {
if (maskInteraction == value) return;
maskInteraction = value;
materialsNeedUpdate = true;
}
get { return maskInteraction; }
}
#endif
/// <summary>Use this Dictionary to override a Material with a different Material.</summary> /// <summary>Use this Dictionary to override a Material with a different Material.</summary>
public Dictionary<Material, Material> CustomMaterialOverride { public Dictionary<Material, Material> CustomMaterialOverride {
get { materialsNeedUpdate = true; return customMaterialOverride; } get { materialsNeedUpdate = true; return customMaterialOverride; }
@ -790,8 +801,7 @@ namespace Spine.Unity {
break; break;
} }
} }
} } finally {
finally {
preventReentrance = false; preventReentrance = false;
} }
} }