[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,9 +347,10 @@
- Spine Physics: `UpdateWorldTransform(Skeleton.Physics.Update)``UpdateWorldTransform(Spine.Physics.Update)`
- 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.
- `SkeletonRenderer`: `maskInteraction``MaskInteraction`.
- **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.
- **Additions**
- Added Spine Preferences `Switch Texture Workflow` functionality to quickly switch to the respective PMA or straight-alpha texture and material presets.
- Added a workflow mismatch dialog showing whenever problematic PMA vs. straight alpha settings are detected at a newly imported `.atlas.txt` file. Invalid settings include the atlas being PMA and project using Linear color space, and a mismatch of Auto-Import presets set to straight alpha compared to the atlas being PMA and vice versa. The dialog offers an option to automatically fix the problematic setting on the import side and links website documentation for export settings. This dialog can be disabled and re-enabled via Spine preferences.

View File

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

View File

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

View File

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

View File

@ -118,10 +118,8 @@ namespace Spine.Unity {
#endif
#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 = SpriteMaskInteraction.None;
/// <seealso cref="MaskInteraction"/>
protected SpriteMaskInteraction maskInteraction = SpriteMaskInteraction.None;
/// <summary>Cached reference to the already setup material override set at the respective
/// SkeletonDataAsset.atlasAssets array entry.</summary>
@ -160,6 +158,19 @@ namespace Spine.Unity {
#region 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>
public Dictionary<Material, Material> CustomMaterialOverride {
get { materialsNeedUpdate = true; return customMaterialOverride; }
@ -790,8 +801,7 @@ namespace Spine.Unity {
break;
}
}
}
finally {
} finally {
preventReentrance = false;
}
}