Hi,
I want to give hints to player when player press the button. When player press the button, button will change color of the sprite. I wrote the code and tested in “Game” tab and It worked. But When I use “Simulator” tab, sprite’s color doesn’t change. It is still white. I also tested it on Unity Remote and result didn’t change.
Here is the code I wrote. Thank you for replies.
public void GiveHint()
{
if (hintCount > 0)
{
// Get "List<GameObject> hints" lenght.
int Lenght = hints.Count;
// Create random number between 0 and Lenght variable to determine which hint(sprite) show up.
int random = Random.Range(0, Lenght);
// Change color of the sprite(hint).
hints[random].GetComponent<SpriteRenderer>().color = Color.green;
// Remove the sprite from the hints list.
hints.RemoveAt(random);
// Remaning hints.
hintCount--;
}
}