I am trying the change the opacity of a sprite using the color property on the sprite. This is the code(c#):
ghostPart.gameObject.GetComponent<SpriteRenderer>().color.a = 0.5f;
but is comes up with error:
Cannot modify a value type return value of ‘UnityEngine.SpriteRenderer.color’.