Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Im getting: error CS0029: Cannot implicitly convert type 'bool' to 'UnityEngine.GameObject', Help!

$
0
0
This is my script: ---------------------------------------------------------------------------------- public GameObject caj_closed, caj_opened, intText, lockedtext; public AudioSource open, close; public bool cajopen, cajlocked; public static bool keycajon; void Start(){ keycajon = false; } void OnTriggerStay(Collider other){ if(other.CompareTag("MainCamera")){ if(cajopen == false){ if(cajlocked == false){ intText.SetActive(true); if(Input.GetKeyDown(KeyCode.E)){ caj_closed.SetActive(false); caj_opened.SetActive(true); intText.SetActive(false); StartCoroutine(repeat()); cajopen = true; } } if(cajlocked == true){ lockedtext.SetActive(true); } } } } void OnTriggerExit(Collider other){ if(other.CompareTag("MainCamera")){ intText.SetActive(false); lockedtext.SetActive(false); } } IEnumerator repeat(){ yield return new WaitForSeconds(4.0f); caj_opened = false; caj_closed.SetActive(true); caj_opened.SetActive(false); close.Play(); } void Update(){ if(keycajon == true){ cajlocked = false; } } } Its a direct copy just changing some names of this other script, which works PERFECTLY! ------------------------------------------------------------------------------------------ public GameObject door_closed, door_opened, intText, lockedtext; public AudioSource open, close; public bool opened, locked; public static bool keyfound; void Start(){ keyfound = false; } void OnTriggerStay(Collider other){ if(other.CompareTag("MainCamera")){ if(opened == false){ if(locked == false){ intText.SetActive(true); if(Input.GetKeyDown(KeyCode.E)){ door_closed.SetActive(false); door_opened.SetActive(true); intText.SetActive(false); StartCoroutine(repeat()); opened = true; } } if(locked == true){ lockedtext.SetActive(true); } } } } void OnTriggerExit(Collider other){ if(other.CompareTag("MainCamera")){ intText.SetActive(false); lockedtext.SetActive(false); } } IEnumerator repeat(){ yield return new WaitForSeconds(4.0f); opened = false; door_closed.SetActive(true); door_opened.SetActive(false); close.Play(); } void Update(){ if(keyfound == true){ locked = false; } } } And I dont know whats wrong, can anyone help me?

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>