Problems with Alpha when Sampling Texture 2D

I have added a new sprite and I want to create a glow around it using shaders → Material.

It looks fine in the normal editor:

But it breaks when sampled in Shader:

Also, is there a preferred way to change Material programmatically to enable and disable glow?


I dont known why it “breaks”

But, to change a material, just need to, fore xample, have a material in the Resources folder of your assets called “Material Glow”

Material NewMaterial = Resources.Load("Material Glow") as Material;

then, somewhere

gameObject.GetComponent<MeshRenderer>().material = NewMaterial