Between Unity 2022.3 LTS and Unity 2023.1 there is an inconsistency of what happens when SpriteRenderer’s sprite is changed in the editor. In LTS the material’s _MainTex is updated and in 2023.1 it isn’t. A guy from the bug portal is saying that it is all fine but it does not seem so to me considering that in 2023.1 ShaderGraph’s TextureSize node is not outputting the correct _MainTex size of the sprite assigned in the SpriteRenderer.
I just noticed this today when trying out 2023.3.0a16. Dragging a sprite asset into the scene and assigning the custom material to the SpriteRenderer for the first time will inherit the sprite, but any future changes do not apply to the material. Using the default sprite material does work correctly however.
SpriteRenderers have always used a single-material for all GameObjects as long as they use the same shaders. This is because :
Minimize CPU/Memory cost associated with multiple materials.
Sprites are always dynamically batched.
The way this is achieved is through internally setting the MainTex to MaterialPropertyBlock of Renderer.
Note: For 3D Renderers such as MeshRenderer, each Mesh Asset creates a unique Material asset for each unique Texture.
In 2023.1 we added suppport for SRP Batcher for 2D Renderers to further optimize rendering pipeline especially for 2D URP. However SRP batcher is not compatible with MaterialPropertyBlocks and hence we updated our SRP Batcher implementation to meet this requirement. Again note that the SRP Batcher support we added is slightly different from 3D Renderers.
The Material Editor you see above merely gets the Texture from the MBP and is just for visualization. Hence if SRP Batcher is enabled MaterialEditor will not show the MainTex. If you really want to have this in the Editor, please disable SRP Batcher and restart the Editor. Hope this helps. Please let us know if you need more info.
You can disable SRP Batcher either for a specific Renderer or a specific Shader and doesn’t need global disable of SRPBatcher.
Please take a look at : Unity - Manual: Scriptable Render Pipeline Batcher (unity3d.com)
Check info under Removing shader compatibility and Removing renderer compatibility