I have a full screen sprite. Before I was dealing with 2D lights, when I needed to change the Sprite, I simply changed it with something like this:
this.gameObject.GetComponent().sprite = L2B1;
Now that I’m using 2D lights, the new sprites seem to be coming in with Sprite-Default as their material. But with the onscreen lights, I need the sprite to retain Sprite-Lit-Default material. I know that a simple line of code like the following, will allow me to assign a material:
this.gameObject.GetComponent().material = newMaterialRef;
What I don’t know is how to assign the already existing material of sprite-lit-default to newMaterialRef.