Time for action – assigning values while declaring the variable
Add some more variables to LearningScript
using the types shown in the previous chart. While declaring the variables, assign them values as shown in the following screenshot. See how they are presented in the Inspector panel. These are all public
variables so they will appear in the Inspector panel:
What just happened?
The following screenshot shows what Unity presents in the Inspector panel:
The variables are displayed in the Inspector panel with the values already set.
Where you declare ...
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.