感谢您的信息,现在我可以看到文件了。 🙂 一旦我们弄清楚出了什么问题,我们会尽快回复您。
Thanks for the info, now I can see the files. 🙂 We will get back to you as soon as we've figured out what's going wrong.
不幸的是,Unity 的屏蔽和启用了“覆盖排序”的嵌套“画布”似乎存在普遍问题(错误或限制)。 您还可以看到普通 Image
GameObject 存在问题,如果您将其移出滚动视图边界,它不会被父 GameObject Viewport
Mask 屏蔽。
您可以在 Unity 论坛上找到有关它的讨论:
https://forum.unity.com/threads/mask-with-nested-canvas-with-override-sorting.783620/
不幸的是,这个问题似乎在最近的 Unity 版本(如 2022.2)中仍然存在。
最简单的解决方案是删除所有“Canvas”组件或禁用“Override Sorting”。 这样做会按我的预期显示所有内容。 你有这么多 Canvas
组件是有原因的吗?
或者,您可以尝试使用上述论坛主题中提到的 EnableRectClipping
的变通解决方案,或者使用另一种避免使用嵌套 Canvas
组件的方法。 如果您只想在骨架中分层单个 Sprite 图像,您可以通过编程方式从 Sprite
创建附件(如 Spine Examples/Other Examples/Mix and Match
示例场景所示)并将其附加到您的骨架。
否则,恐怕在当前的 Unity 版本中使用 Mask 和嵌套的 Canvas 并启用 Override Sorting
会导致不正确的结果。
Unfortunately there seems to be a general problem (bug or limitation) with Unity's masking and having a nested Canvas
with Override Sorting
enabled. You can also see a problem with the normal Image
GameObject, which is not masked by the parent GameObject Viewport
Mask if you move it out of the scroll-view bounds.
You can find discussion about it here on the Unity forum:
https://forum.unity.com/threads/mask-with-nested-canvas-with-override-sorting.783620/
Unfortuantely this problem still seems to exist in recent Unity versions like 2022.2.
The easiest solution would be to remove all Canvas
components or disabled Override Sorting
. Doing this displays everything as expected for me. Is there a reason why you have so many Canvas
components?
Alternatively, you could try the workaround solution using EnableRectClipping
as mentioned in the above forum thread, or use another way that avoids using nested Canvas
components. If you only want to layer single Sprite images in your skeletons, you could programmatically create an attachment from a Sprite
(as shown in the Spine Examples/Other Examples/Mix and Match
example scene) and attach it to your skeleton.
Otherwise, I'm afraid using a Mask and a nested Canvas
with enabled Override Sorting
will lead to incorrect results in current Unity versions.