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.
- Modify
LearningScript
as shown in the next screenshot. - Notice the change on line 2.
- Save the file.
- In Unity, click on Play.
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
:
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.