Quantcast
Channel: Questions in topic: "clone"
Viewing all articles
Browse latest Browse all 508

Changing sprite alpha on all prefab clones

$
0
0
I'm trying to change the alpha/transparency of all clones of the prefab. The transparency of the prefab itself changes correctly, but when I put multiple clones of the same prefab in the scene only one clone changes. The prefab is a sprite and the alpha is changed when a key is pressed in the PlayerController: //--TRANSPARENCY--// if (PlayerController.toggleSpirit) { if (!isLocked) { isSpirit = !isSpirit; } PlayerController.toggleSpirit = false; } if (isSpirit) { sr.color = new Color(1f, 1f, 1f, .5f); } else if (isSpirit == false) { sr.color = new Color(1f, 1f, 1f, 1f); } The sr.color is getting the SpriteRenderer Component.

Viewing all articles
Browse latest Browse all 508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>