UnityGame/Library/PackageCache/com.unity.ai.navigation/Samples~/Scripts/Despawner.cs
2024-10-27 10:53:47 +03:00

18 lines
366 B
C#

using System;
using UnityEngine;
namespace Unity.AI.Navigation.Samples
{
/// <summary>
/// Destroy GameObjects upon collision
/// </summary>
[RequireComponent(typeof(Collider))]
public class Despawner : MonoBehaviour
{
void OnCollisionEnter(Collision collision)
{
Destroy(collision.gameObject);
}
}
}