public IEnumerator NPCCloseInfoPanelTest() { game = MonoBehaviour.Instantiate(Resources.Load <GameObject>("Game")); yield return(new WaitForSecondsRealtime(1f)); npc = GameObject.FindGameObjectsWithTag("NPC")[0].GetComponent <Npc>(); infoPanel = GameObject.Find("Canvas").transform.Find("InfoPanel").transform.Find("Text").GetComponent <Text>(); npc.CloseInfoPanel(); yield return(new WaitForSecondsRealtime(0.5f)); Assert.IsFalse(infoPanel.IsActive()); GameObject.Destroy(game); }