Search Issue Tracker

By Design

Votes

0

Found in

6000.0.20f1

Issue ID

UUM-82378

Regression

Yes

Texture2D "_MainTex" ShaderGraph property reference is empty when attached to a GameObject with a SpriteRenderer

--

-

Reproduction steps:
1. Open the attached “MainTex.zip” project
2. Select the “Triangle” GameObject from the Hierarchy
3. In the Inspector expand the shader properties
4. Observe the _MainTex property

Expected result: Sprite is visible in the _MainTex property
Actual result: The _MainTex property is empty

Reproducible with: 6000.0.18f1, 6000.0.20f1
Not reproducible with: 2021.3.44f1, 2022.3.47f1, 6000.0.17f1

Reproduced on: Windows 10 (User reported), Windows 11
Not reproducible on: No other environment tested

  1. Resolution Note:

    The shadergraph SpriteLit is relying on SpriteRenderer's color being set on the Vertex Channel.
    This is only valid for Dynamic-Batching as Renderer Color is baked to Vertex Colors (mainly when batching multiples sprites that use the same texture (atlas, spritesheets etc.) but use different Color.
    This is not valid when using SRP-Batcher and Renderer Color is set in unity_SpriteColor instead when SRP-Batcher is active.
    So either disable SRP-Batcher or make Shader incompatible with SRP-batcher.
    See Removing shader compatibility in https://docs.unity3d.com/Manual/SRPBatcher.html

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.