- Home /
How to instance custom sprite shader?
I have been trying to instance a custom written shader based on the built-in sprite shader in UnitySprite.cginc.
I have spent some time understanding all of the instancing macros defined in UnityInstancing.cginc and from what I can understand I'm doing everything as they should be done.
The results on the screen look like they should, but when I open the Frame Debugger and look at the draw stack I see that not all of my sprites get instanced. They are instanced in small groups or not at all. (The Dynamic Batches at the beginning and end are not my sprites) The reason it gives is that some non-instanced properties are set. I have spent a lot of time going through my own code making sure I don't set any non-instanced properties.
My question is now; are there other things that affect what properties are set? Right now I'm suspecting that the SpriteRenderer is setting some property but I can't find out what property that would be. I'm setting a texture to the material, but it's the same for every sprite (because they use the same material).
Is there some quirk with instancing that I am missing or is there some other reason for this behavior?
Your answer
Follow this Question
Related Questions
Crop/Mask a Sprite on runtime 0 Answers
WebGL sprite appears pink? 0 Answers
Sprite Renderer & UI Image bad Sprite quality 2 Answers
Allow 2D sprite to receive light from any direction and show on both sides 0 Answers
SpriteRender's sprite not changing 1 Answer