Hi, I’m making a game where you need to collect 5 objects in order to destroy one.
Ex: You need to 5 coins in order to break the crate.
Thanks.
Hi, I’m making a game where you need to collect 5 objects in order to destroy one.
Ex: You need to 5 coins in order to break the crate.
Thanks.
var coinsCollected = 0;
var Crate : GameObject;
function OnTriggerEnter(col : Collider)
{
if (col == "Coin")
{
coinsCollected += 1;
}
}
function Update()
{
if (coinsCollected == 5)
{
Destroy(Crate);
}
}