I have this raycast system to make an object clickable and then call a function to activate a few things, I tried to take out those things and simply make it print something to see if it is working, but it isn’t, please help.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Holededuct : MonoBehaviour
{
public Component bedUnlock;
public GameObject vidPlayer;
public int tStop;
//I used ray2 and hit2 in the names because I already have another raycast
Ray ray2;
RaycastHit hit2;
void Start()
{
bedUnlock.GetComponent<BoxCollider>().enabled = false;
vidPlayer.SetActive(false);
}
void OnTriggerStay()
{
ray2 = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray2, out hit2))
{
if (Input.GetMouseButtonDown(0))
holeFlashback();
}
}
void holeFlashback()
{
bedUnlock.GetComponent<BoxCollider>().enabled = true;
vidPlayer.SetActive(true);
Destroy(vidPlayer, timeStop);
}
}