Assigning values while declaring a 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'll appear in the Inspector panel.

Assigning values while declaring a variable

This screenshot shows what Unity presents in the Inspector panel:

Assigning values while declaring a variable

The variables are displayed in the Inspector panel with the values set by default in the code. Remember that from now on, the value in the Inspector panel will override the value in the code, so if you decide to change your code a little, the value in Inspector will stay as it was initially.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset