private IEnumerator Initialize() { while (_secretsManager == null) { yield return(new WaitForEndOfFrame()); _secretsManager = Director.GetManager <SecretsManager>(); } string[] splitlines = text.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); foreach (var paragraphString in splitlines) { List <Text> thisParagraph = new List <Text>(); foreach (var word in paragraphString.Split(' ')) { SecretData secret = _secretsManager.GetSecretData(word); Text currentWord = null; if (secret != null) { currentWord = Instantiate(emtpyWordCodedPrefab, transform); SecretDisplay display = currentWord.GetComponent <SecretDisplay>(); display.Initialize(secret, word); display.OnPointerEnter += OnSecretMouseEnter; display.OnPointerExit += OnSecretMouseExit; display.OnClick += OnSecretClicked; } else { currentWord = Instantiate(emtpyWordPrefab, transform); } currentWord.text = word + " "; thisParagraph.Add(currentWord); } _paragraphs.Add(thisParagraph); } OrganizeWords(); }