
It looks like you're new here. If you want to get involved, click one of these buttons!
i have an rgb color >>
public Color red = new Color (218,107,96);
when i set it to the sprite after an action or something like this >>
void OnCollisionEnter2D (Collision2D other)
{
if (other.gameObject.tag == "red") {
gameObject.GetComponent<SpriteRenderer> ().color = red;
}
}
.... nothing happens and the color does not change ??
Answers
It will be
other.gameObject.GetComponent<SpriteRenderer> ().color = red;
Include other before your code and check result
but i want to change the objects color that this script attached to ... not the other object !!