• RuntimesUnityBugs
  • Spine/RenderQuad Opacity Issue on Android Device

Problem statement

We're using a RenderTexture to render one of our Skeletons in the game we're working on, specifically so that we can apply a transparency to the skeleton without the overlapping symbol issues that setting it on the Skeleton itself would cause.

For this we use the SkeletonRenderTexture class from your Spine Examples/Scripts/Sample Components/SkeletonRenderTexture folder. In editor this works fine and the opacity is properly rendered on the quad. But on Android devices the opacity is ignored entirely.

Workaround

Changing the following line
quadMeshRenderer.material = new Material(Shader.Find("Spine/RenderQuad"));
to
quadMeshRenderer.material = new Material(Shader.Find("Sprites/Default"));
fixes the issue and the opacity is then properly rendered on Android devices.

I'm assuming this must just be a small bug with the shader being used for the Spine/RenderQuad, which isn't present in the Sprites/Default shader?

Runtime information

Unity 2021.3.20f1 using Spine v4.2.67

Related Discussions
...

The issue you're experiencing with the Spine/RenderQuad shader not rendering opacity correctly on Android devices is likely due to the shader not being included in the build. This can happen if the shader is not added to the "Always included shaders" list in Unity's Graphics settings.

To resolve this, you can add the Spine/RenderQuad shader to the "Always included shaders" list:

  1. Open Unity and go to Edit > Project Settings > Graphics.
  2. In the Graphics settings, find the "Always included shaders" section.
  3. Click the "+" button to add a new shader.
  4. Select the Spine/RenderQuad shader from the list.

This should ensure that the shader is included in the build and works correctly on Android devices.

Additionally, there was a recent bugfix related to viewport offsets for SkeletonRenderTexture and SkeletonGraphicRenderTexture in the latest spine-unity 4.2 package. You might want to update to the latest version to ensure all recent fixes are applied:

Download the latest spine-unity 4.2 package

If the problem persists after these steps, please let us know.

@ExNull-Tyelor Spinebot is correct. Note that you can assign a Material at the Quad Material property at the SkeletonRenderTexture (automatically assigns RenderQuadMaterial upon component-reset). Only when no material is assigned at this property a new material is created which programmatically assigns the Spine/RenderQuad shader, which then needs to be added to the Always included shaders as Spinebot described.

Also be sure to update to the latest 4.2 spine-unity package as the fix regarding viewport offsets was made because of display issues with Vulkan. While it might not be the cause of your issue, it's better to be on the safe side for the future.

    Harald Indeed Spinebot was correct! Thank you to you for the quick reply. Adding the shaders I use (Spine/Skeleton, Spine/SkeletonGraphic, and Spine/RenderQuad) to the Always included shaders indeed allowed the opacity to work properly on device.

    I'll be sure to update to the latest version today to get the viewport offset bugfix as well, so thanks for the heads up on that!