Time for action – create a List of pony names

Create a List that stores the names of some ponies. Since they are names, use the string type.

  1. Modify LearningScript as shown in the next screenshot.
  2. Notice the change on line 2.
  3. Save the file.
  4. In Unity, click on Play.
    Time for action – create a List of pony names

What just happened?

The following screenshot is the Console output. Notice the first output tells you there is a total of 3 elements in the List:

What just happened?

Note

Please notice that your code is using dot syntax, which will be discussed in more detail in the next chapter. The main concepts I want you to focus ...

Get Learning C# by Developing Games with Unity 3D Beginner's Guide 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.