Problem statement

Hi there!

As shown in the video above, some of the assets are not displayed completely in the UI Toolkit Editor.

I tried to add a graphic into the UIToolkit editor, expected it to be displayed but instead it was partially or not displayed at all. This only happens with a few assets, I was not able to figure out the differences (if any) between the ones that are being correctly displayed and the ones that are not.

Thanks! I'm willing to help with any other details you might need.

Repro steps

sample.zip
46kB
  1. Open the Repro .uxml document
  2. Make sure ko-default-down_SkeletonData is selected as the skeleton data.
  3. Set the animation to idle / walk / attack and the skin to default.
  4. The asset is not rendered.

Runtime information

Runtime Version 4.2.84
UI Toolkit Module version: 4.2.0-preview.2
Unity Editor version: 6000.0.25f1

Related Discussions
...

It seems like you are experiencing an issue where some graphics are not rendering correctly in the UI Toolkit Editor. This could be related to the specific setup or configuration of your assets or the way they are being handled by the UI Toolkit. A common approach to troubleshooting such issues is to ensure that the correct materials and shaders are being used, especially if you are using Spine assets. For example, when using SkeletonGraphic components, it's important to use a compatible shader as mentioned in the context about rendering issues with SkeletonGraphic. You might want to check if the materials assigned to your assets are using the correct shaders and if there are any discrepancies in the asset setup that could affect rendering.

If the issue persists, consider creating a minimal Unity project that reproduces the problem and reviewing the setup of your assets and materials. This can help identify any specific configurations that might be causing the rendering issues.

    Spinebot Replying to this for extra context, I have double checked the shaders and I'm just using the default Spine/Skeleton, it's worth to mention that this was working perfectly fine with the skeleton graphic, but since we're moving to UITK we had to change it for the SpineElement

    @franmvoisard Sorry to hear you're having troubles! As you're using spine-unity version 4.2.84 which is not up to date, could you perhaps have a try whether the issue still persists when using the latest spine-unity 4.2 version, which is 4.2.100?

    In general there are no custom shaders used with UITK (you can't set a custom shader), so that should not be the problem. The downside is that it thus does not support PMA or advanced features (yet).

      Harald Thanks for replying. I have tried upgrading to spine 4.2.100 but this issue still persists. Any ideas what it could be?

      @franmvoisard Thanks for testing, sorry to hear the issue persists! We've just checked your reproduction assets, the problem seems to be due to backface culling. Your skeleton's root bone is flipped via Scale X set to -1 (in your Spine project). This turns front-facing triangles into backfacing ones, which UI Toolkit unfortunately discards and seems to not provide any setting to customize cull mode, as VisualElement does not allow setting a custom Material or Shader. So if anyone knows a way how cull mode or a custom shader can be used, please do let us know.

      A simple solution would be to change the root bone Scale X value from -1 to 1 and instead flipping the UI visual element.

      Note that the Spine Editor by default has culling disabled, you can enable Viewport - Backface Culling in the settings here to visualize the effect in the Editor as well.