O'Reilly logo

Mastering Unity Scripting by Alan Thorn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Strings and regular expressions

Working with text data is critical and for many reasons. If you need to display subtitles, show in-game text, and implement localization functionality (supporting multiple languages), then you would be working with text, specifically with Text Assets. In Unity, Text Assets refer to any text files included in the Unity project, and each asset is treated as one long string even when multiple lines are involved (each line is separated by a \n escape character). Once your code is presented with a string like this, however, there're typically many ways in which you'll want to process it. Let's see some common but important string operations.

Null, empty strings, and white space

When processing strings, you can't always ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required