Changing sprite alpha on all prefab clones
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.
Your answer
Follow this Question
Related Questions
The interactable part of my button is random and do not respect the alpha setting 0 Answers
Making A Model Transparent/Fade? Unity-chan etc... 3 days no results! 0 Answers
Instantiated prefab clones don't collide like the original 2 Answers
How to remove all velocity for all prefab/clone objects in the scene 1 Answer
Is it possible to make multiple prefabs out of a single prefab for use in the map editor? 0 Answers