private void OnTriggerExit(Collider collision) { //check if other is also answer object only if (collision.gameObject.GetComponent <AnswerObject>()) { currentLink = null; } else if (collision.gameObject.GetComponent <Hangi>()) { hangi = null; } }
/* * private void OnCollisionEnter(Collision collision) * { * //check if other is also answer object only * if (collision.gameObject.GetComponent<AnswerObject>()) * { * currentLink = collision.gameObject.GetComponent<AnswerObject>(); * Debug.Log("Bruh"); * } * } * * private void OnCollisionExit(Collision collision) * { * //check if other is also answer object only * if (collision.gameObject.GetComponent<AnswerObject>()) * { * currentLink = null; * } * } */ private void OnTriggerEnter(Collider collision) { //check if other is also answer object only if (collision.gameObject.GetComponent <AnswerObject>()) { currentLink = collision.gameObject.GetComponent <AnswerObject>(); //Debug.Log("Bruh"); } else if (collision.gameObject.GetComponent <Hangi>()) { hangi = collision.gameObject.GetComponent <Hangi>(); } }