- Home /
Question by
caickRNG · Sep 20, 2017 at 06:16 PM ·
c#colorcolor change
When a ball is clicked and background color matches it's color I get a point?
I have 4 balls each with different colors that keep spawning, and the background keep changing colors after 2.5secs, what I couldn't do is that I should get a point when I click in the ball only when the background color matches it. Here's the background code:
Camera cam;
public Color[] bgColor;
void Start () {
cam = Camera.main;
StartCoroutine (colorChange());
}
IEnumerator colorChange ()
{
yield return new WaitForSeconds (2.5f);
cam.backgroundColor = bgColor [Random.Range(0, bgColor.Length)];
StartCoroutine (colorChange());
}
}
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Smooth Camera Background Color Changing? 1 Answer
SpriteRender.color not changing the color 1 Answer
Distribute terrain in zones 3 Answers
Change startcolor of particle system through script 1 Answer