I am working on 2D platform game. I have a sprite with a material and a shader I found here.
The shader have a value property that effect the dissolve effect of the sprite, but if I have the same GameObject multi times in my scene (as a prefab or instantiated through code), changing the dissolve value on one material affects all GameObjects with the same material (I tried changing material name, clone the material and all kind of stuff), I think I understated now that it his happening because I use the same sprite (image)
What can I do to avoid that kind of behavior?
float dissolvePower = dissoleMaterial.GetFloat(dissolveProperty);
float minus = -0.1f;
while (dissolvePower > 0)
{
//print(dissolvePower);
dissolvePower += minus;
dissoleMaterial.SetFloat(dissolveProperty, dissolvePower);
yield return new WaitForSeconds(0.07f);
}
print("Exit DeathDissolve()");
Destroy(gameObject);