using System.Collections; using System.Collections.Generic; using UnityEngine; public class FallawayFloor : MonoBehaviour { public float speed; Rigidbody rb; private void Start() { rb = GetComponent(); } private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { StartCoroutine(DestroyFloor()); } } IEnumerator DestroyFloor() { rb.velocity = Vector3.down * speed; yield return new WaitForSeconds(1); Destroy(gameObject); yield return null; } }