void OnTriggerEnter(Collider otherObject)
{
if(otherObject.name == "untitled")
{
StartCoroutine(animthendestroy());
}
IEnumerator animthendestroy()
{
animation.Play();
yield return new WaitForSeconds(here you enter the seconds it takes to play the anim();
Destroy(otherObject.gameObject);
}
↧