Here is my problem.
I want a trigger to activate a cave-in once the player has entered it, however using the below code, no debug log is written.
I’m somewhat new to C#, so I apologise if it is a dull mistake.
My main culprit, at least in my mind, is the game object that I’ve assigned the script to, which is the trigger itself. Is this correct?
I’ve set the collider to “other” to test, but I’ve also set it to player with the same lack of result.
Thank you all so much for your help!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Cavein_Event : MonoBehaviour
{
public GameObject playerCollider;
public GameObject Collider;
void Start()
{
playerCollider = GameObject.FindGameObjectWithTag("Player");
Collider = GameObject.Find("Cavein_Trigger");
}
private void OnTriggerEnter(Collider other)
{
Debug.Log("TriggerActivated");
}
}