Hello, I’m making a game using Unity 5.
I have an image on UI canvas that I want to display the amount of collected items, I have it with a counter, but what I want is to replace the numbers by the image.
This is what I have:
This is the code (C#) that updates the counter text:
void CollectCandy (Collider2D candyCollider)
{
candiesCollected++;
Destroy (candyCollider.gameObject);
AudioSource.PlayClipAtPoint (candyCollectSound, transform.position);
candiesLabel.text = candiesCollected.ToString ();
}
What I need to know is what would be the best way to use the image as a collected items meter, I have the sprites to use whit it
I was thinking on use an animation and going frame by frame but I don’t know how to do that, I also was thinking on trying to replace the UI Image’s source by script, but I can’t figure out how to do that either.
Can you help me how to make this part working?
Thanks.