- Home /
How to make a sprite flash different colors?
Hi all. I'm trying to make a 2D memory game, but I'm VERY rusty with my programming. I'm having a little trouble getting started -- I currently have a sprite of a computer and then four buttons underneath it (red green blue yellow.)
I want the computer screen (of the sprite) to flash one of the four colors (one at a time) until it completes a sequence. For example, computer flashes "red, then blue, blue, green, blue, red", then the user would have to click the buttons and input the same sequence. I am not sure how to make the sprite change colors like that, and I'm not sure how to check to see if the user's input was right.
Any help is greatly appreciated, I have no code as of now lol. Thanks!
Answer by Zaeran · Sep 11, 2020 at 03:28 PM
You've got two main options.
Create a button sprite of each colour and swap them out when required
Create a white sprite for the buttons, and use GetComponent().color to set the colour as required
Your answer
Follow this Question
Related Questions
SpriteRender.color not changing the color 1 Answer
Unity 2020.3 URP shader color won't change properly 0 Answers
Having trouble resetting the color of an object after the trigger leaves 0 Answers
Unity 2D Sprite is invisible. 2 Answers
Need help getting bullets to go the right direction is a 2D enviroment 1 Answer