IEnumerator acionarPorta() { fade.fadeIn(); yield return(new WaitWhile(() => fade.fume.color.a < 0.9f)); playerScript.gameObject.SetActive(false); switch (escuro) { case true: playerScript.changeMaterial(luz2D); break; case false: playerScript.changeMaterial(padrao2D); break; } playerScript.transform.position = destino.position; yield return(new WaitForSeconds(0.5f)); playerScript.gameObject.SetActive(true); fade.fadeOut(); }