Comments

  • The WordList class features the Get and Set properties to control class instantiation, making it a Singleton.
  • In addition to being a Singleton, WordList also calls the DontDestroyOnLoad function. This prevents the object from being destroyed when the scene ends, allowing it to carry over to the next scene.
  • Take care when using DontDestroyOnLoad, as all child objects and associated texture and mesh resources on the object will also survive and continue to the next scene.

The first programmatic step in working with the WordList is to tokenize the text file. This means we need to generate a complete array of all words in the file, separating the words as distinct units, as opposed to being part of a long string spanning the length ...

Get Mastering Unity 2017 Game Development with C# - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.