So I am trying to make my obstacle/killer to disappear first before I attempt to actually make it kill and reset the game, but I am struggling with that still. This below is my code but my obstacle doesn’t seem to really disappear when my player collides with it. yes, I do have box collider 2D and I do have is trigger box checked. my player collides with other things but not this killer obstacle. No need to worry about the damage or health variable for now. Help me with my issue please :)) Thank you
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Killerboi : MonoBehaviour
{
public int damage = 3;
void OnTriggerEnter2D(Collider2D other)
{
if(other.CompareTag("Player"))
{
//death
other.GetComponent<PlayerMovement>().health -= damage;
Destroy(gameObject);
}
}
}