Custom Transparent Shader Not Rendering on Device Despite Valid Gaze Input

I’m encountering a rendering issue on Magic Leap 2 (OpenXR) when using a prefab that contains a transparent shader intended to simulate central vision loss (gaze-based alpha mask).

Expected Behavior

The prefab consists of a Quad with a transparent shader that renders a circular alpha mask at the user’s gaze point. It works correctly in Project A. In Project B, the exact same prefab does not render on device—even though the same shader, material, and parameters are used.


Environment

  • Unity Editor: 2022.3.22f1
  • Magic Leap 2 OS: 1.12.0
  • Magic Leap SDK (OpenXR): 1.12.0
  • Host OS: Windows 10

Observed Behavior

  • The prefab is active, in front of the camera, and using the correct material.
  • Renderer.enabled is true, the material is assigned, and gameObject.activeInHierarchy == true.
  • The shader includes:
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
Cull Off
Tags { "Queue"="Transparent" "RenderType"="Transparent" }
  • Gaze data is correctly received and passed to the shader as _FocusPoint.
  • Shader debug version that returns solid red (return half4(1, 0, 0, 1)) still does not render.
  • Culling mask, camera clip planes, and clear flags have all been tested with appropriate settings.

However:

When I manually duplicate the same Quad from the prefab in the scene hierarchy, the duplicated object renders correctly on the device.

This suggests the issue is not with the shader or material, but rather with the prefab instance or something related to its structure.


What I’ve Tried

  • Reassigning layers and verifying camera culling mask
  • Unpacking the prefab completely and reassigning material
  • Replacing the prefab with a manually duplicated and working version
  • Checking for Canvas, UI, or hidden child objects inside the prefab
  • Resetting transforms, scale, and parenting
  • Forcing rendering from a specific world position facing the camera

My Question

What could cause a prefab instance (that is correctly active, positioned, layered, and using a valid material) to fail rendering in an XR context, while a directly duplicated Quad from that prefab works?

Are there known issues with prefab instancing or object hierarchy in Magic Leap 2 (OpenXR) projects that could cause this behavior?

Any suggestions would be appreciated.

Thanks.

That does sound like a tricky issue. While I can’t provide a specific workaround, you may want to look at building a development build of your application and then using Unity’s Frame Debugger.

The Frame Debugger will allow you to step through draw calls and see if the object is ever rendered. You also may want to make sure that it’s not marked as “static” in the scene. Lastly you may want to try simply parenting it directly to the camera at a 1 meter distance. Note that the near clip plane is enforced on the Magic Leap and will prevent objects from rendering if they are closer than 0.37 meters ( 37 centimeters )