using System.Collections; using System.Collections.Generic; using UnityEngine; public class opendoor : MonoBehaviour { public GameObject gg; public GameObject ll; private bool cc = false; void Start() { } // Update is called once per frame void Update() { if(Input.GetKeyDown(KeyCode.E)) { Debug.Log(cc); if(cc) { this.gg.SetActive(false); this.GetComponent().isTrigger = true; ll.SetActive(true); } } } private void OnCollisionEnter(Collision collision) { cc = true; Debug.Log(collision.gameObject.name); } private void OnCollisionExit(Collision collision) { cc = false; Debug.Log(cc); } private void OnTriggerEnter(Collider other) { Debug.Log("trigger enter"); } private void OnTriggerStay(Collider other) { Debug.Log(other.gameObject.name); } private void OnTriggerExit(Collider other) { Debug.Log("trigger exit!!!!!!!!!!!!!!!!!"); } }