I’m trying to keyword tips in my game using textInfo, when I use a foreach loop on wordInfo to check each word it creates a null reference exception. Any ideas why this might occur?
Arrays for these data structures are allocated in blocks which means the array length will rarely match the size of the valid data.
As such, in order to get the correct # of characters, words, etc. you have to use the textInfo count property. In the case of word count, you would use textInfo.wordCount.
Makes sense, thank you Stephan!