how could i make that when i collect all “hearts” game ends?
Well, we may need a little more info than that.
How are you collecting these hearts?
The way that usually always works, is maybe doing something like, when the number of hearts equals the number of hearts in the level, load the next scene.
var numCollected = 0;
var numTotal = 5;
if(numCollected == numTotal)
{
Application.LoadLevel(“GameEndScene”);
}