Sprite Renderer not working properly with MaterialPropertyBlock and SetPropertyBlock()

Hi all! I’m trying to have the same scene rendered differently depending on which cameras are Camera.current. Each object in the scene has the following component attached to it: https://dpaste.org/Hj4X.

The problem is that when Camera.current is identityCam (see the script), the sprite doesn’t display correctly. It appears to have to do with setting properties. Here is a video of the problem:

. What’s going on here?

Here’s the shader script: https://dpaste.org/trv4.

Caching Unity - Scripting API: Renderer.GetPropertyBlock was the solution

1 Like