Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unity 2D: Spriterenderer or Material??

Discussion in 'Scripting' started by alexandros356, Nov 2, 2016.

  1. alexandros356

    alexandros356

    Joined:
    Dec 3, 2012
    Posts:
    105
    Hi guys,

    So far, I created a sprite from the texture and using it in the sprite renderer component of my game object.
    But, what is the difference if I use directly the texture as a material? In this way I don't have to create a sprite.

    What is the best to do? Is it performance?

    Thanks in advance
     
  2. Defero

    Defero

    Joined:
    Jul 9, 2012
    Posts:
    200
  3. alexandros356

    alexandros356

    Joined:
    Dec 3, 2012
    Posts:
    105
    Thank you.. I'll go for the easy way
     
  4. takatok

    takatok

    Joined:
    Aug 18, 2016
    Posts:
    1,496
    Actually depending on the shader you use it makes a big difference. A sprite has a texture associated with it and all the sprite shaders use it. If you try to create a Texture and set it to the SpriteRender's material's texture nothing will happen. the Sprite Shaders ignore the texture of your material and directly use the texture on the sprite.
     
  5. alexandros356

    alexandros356

    Joined:
    Dec 3, 2012
    Posts:
    105
    I didn't know that... thank you!