- Home /
How to set a sprite on the sprite/default shader?
Total noob question here...Sorry.
But when I create a new material and set the shader to sprite/default, I am not able to select a sprite sheet. I am looking to do something similiar to ExplosionParticle material in the 2D example project. Any suggestions?
Answer by jon419 · Dec 07, 2013 at 09:36 PM
Ok, I figured it out.
I add the image as a texture for a Default Diffuse shader. Then I change the shader to Sprites/Default.
Doesn't seem very intuitive, but it works.
Answer by $$anonymous$$ · Jul 16, 2014 at 10:12 AM
With script you can:
public Sprite alpha;
// Use this for initialization
void Start () {
gameObject.GetComponent<MeshRenderer>().material.mainTexture = alpha.texture;
}
@kaan-Yy : This only work if Sprite is not using multi texture sprite sheet. If Sprite is using a texture where other portions will be of other sprites then your $$anonymous$$eshRenderer material will get whole Texture with all sprites involved. I dont have a solution, but I had the above problem and came here finding a solution!!!
Your answer
![](https://koobas.hobune.stream/wayback/20220613123641im_/https://answers.unity.com/themes/thub/images/avi.jpg)