Full example
In the following image, we see a C# script applied to an object. Within the Rocket class, a public variable moveSpeed and a private variable blastSpeed are declared. The private variable is not given a value when declared but is assigned one in the Update() function, where it is given the value of the public variable moveSpeed, multiplied by 2. The value of this private variable is then used in a new Vector3 variable as the Z-coordinate, which in turn is used to set the velocity value of a Rigidbody object:
Note
Be aware that any value adjusted in the Inspector will override the original value given to a variable within the script. It will not rewrite the value stated in the script, but simply replaces it when the game runs. You can also revert to the values declared in the script by clicking on the Cog icon to the right of the component and choosing Reset from the drop-down menu that appears.
Functions
Functions, or methods as they are also known, may be described as sets of instructions...