I am very new to unity, and this is probably going to seem like a dumb question to all the people who are good at C#, but I don't know why OnTriggerEnter is not working in this program. I have typed it as it said in the tutorial I'm following but it has no effect in the game. Help?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DetectCollisions : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
void OnTriggerEnter(Collider other)
{
Destroy(gameObject);
Destroy(other.gameObject);
}
}
}
I haven't tried anything yet, I don't know what to try.