Hey I hate to come back so soon, but I’m encountering another big issue. What I want now is for the player to be able to destroy an object/enemy by colliding into its trigger, but the object just stays there. I have searched for answers for hours but nothing I found has been able to work. The “Player” tag is for my firstperson controller while the script here is attached to the object that I want destroyed.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class destroy : MonoBehaviour
{
void OnCollisionEnter(Collision other)
{
if (other.gameObject.tag == "Player")
{
Destroy(other.gameObject);
}
}
}