Solved
The script keeps spitting an error out
the error says: “Object reference not set to an instance of an object”
private int layermask = 1 << 8;
private RaycastHit hit;
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(1))
{
if (Physics.Raycast(transform.position, transform.forward*3f, layermask))
{
Debug.Log("gaming");
-- errors here \/
if (hit.collider.gameObject.GetComponentInParent<DoorOpenScript>()) {
DoorOpenScript theOther = hit.collider.gameObject.GetComponentInParent<DoorOpenScript>();
theOther.DoorUsed();
}
}
}
}