How to Deactivate Gameobject on collision with delay (Unity)

preview_player
Показать описание
Unity3d or Unity2019 - Deactivate a Game-object with delay on collision with a Rigidbody

····················································································
➡️ My Templates
····················································································

============================================================
➡️ Follow me on Instagram
============================================================

--------------------------SCRIPT----------------------------
public class Deactivate : MonoBehaviour {

[SerializedField] float delay = 1f;

void OnCollisionEnter(Collision other)
{
StartCoroutine(DelayDeactivate(delay));
}

IEnumerator DelayDeactivate(float _delay)
{
yield return new WaitForSeconds(_delay);
}
}
Рекомендации по теме
Комментарии
Автор

thanks been trying to figure this out for over an hour

wickstar
Автор

I'd love it if you could paste the script in the comments, just for future viewers :)

soareverix
Автор

Sorry, we can't read the script :(

Crystal
join shbcf.ru