Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Shader - SpriteRenderer

Discussion in '2D' started by cloudcamaleoniv, Mar 23, 2017.

  1. cloudcamaleoniv

    cloudcamaleoniv

    Joined:
    May 17, 2013
    Posts:
    57
    Hi guys, so... I'm trying to learn shaders, and I have some questions about the SpriteRenderer shader. Hope you guys could help me.

    > SpriteRenderer is a MonoBehaviour that uses the Sprites-Default.shader (okay, this is a fact)

    > When I, for example, change the Tint property by the SpriteRenderer Inspector, the Shader seems not to be modified, its color still is white. How does Unity does that under the hood?

    > The same goes with Textures. When I have two separate SpriteRenderers in my scene and I try to change one's texture, it does not affect the other, and they have the same material. How's that possible?

    Hope you guys can help me. This is killing me. Can't discover on my own. Thanks.
     
    Hugo-ElectricMonkeys likes this.
  2. mikael_juhala

    mikael_juhala

    Joined:
    Mar 9, 2015
    Posts:
    247
  3. cloudcamaleoniv

    cloudcamaleoniv

    Joined:
    May 17, 2013
    Posts:
    57
    Great, that makes sense. But what about the textures? How can I set each texture separately without replicating in every object with the same material?
     
  4. mikael_juhala

    mikael_juhala

    Joined:
    Mar 9, 2015
    Posts:
    247
    GilCat likes this.
  5. GilCat

    GilCat

    Joined:
    Sep 21, 2013
    Posts:
    676
    What about when sprites have different meshes? I see that it still only makes a single drawcall.
    How does that work?
     
  6. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    GilCat likes this.