I want to Destroy a Game Object with a Lightsword:

I am currently programming a virtual reality game for a school project. I want to destroy a game object with a lightsaber. I programmed it, but somehow it doesn’t work. Can someone help me?:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Destroy : MonoBehaviour
{
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag(“Playstation”))
{
Destroy(gameObject);
}
}
}

  1. Use code tags if you post code!
  2. Put in debug logs inside of the function and if statement to see where the code goes. If nothing triggers, the object the script is on does not have a collider set as trigger, the sword does not have a collider, or the sword (or object, at least 1 of the 2) does not have a rigidbody.

if it’s similar to beat saber, there are youtube videos on how to make that

Destroy is a function name, probably best to not name your class the same.
otherwise this is not really a VR specific problem, i would just check the usual issues i.e. one object must have a rigid body and the collider is set to trigger mode and the other object is correctly tagged.