Layout, Messages, First Script, Assemblies

Notes:

I. Understanding Unity Editor Layout: [Starts At = 00min:00sec]
II. Opening already created Unity Project: [Starts At=11min:39sec]
III. Understanding log messages and errors: [Starts At = 15min:58sec]
IV. Understanding our First Script: [Starts At = 24min:27sec]
V. Understanding C# assemblies: [Starts At = 36min:00sec]

I. Understanding Unity Editor Layout: [Starts At = 00min:00sec]
Unity gets open with Initial layout
Layout: is arrangement of panels (Layouts Dropdown list)
2 by 3,
4 Split,
Default,
Tall,
Wide,
Save Layout,
Delete Layout,
Revert Factory Settings

Demonstrate must attach script for execution.
Always save the scene to save modifications.

II. Opening already created Unity Project: [Starts At=11min:39sec]
1. Double click on Unity icon
2. Click on the Project Name if listed in the Projects tab
or Click on the Open other button, locate the project and click on Select folder button

III. Understanding log messages and errors: [Starts At = 15min:58sec]
In the console panel we see log, warning, and error messages.

1. Log message :
print or Debug.Log methods are used to display log messages
Log messages are used for debuginning

2. Error Messages :
a. Syntax Error : Syntactic errors are handled by Unity (parsing error)
Ex: Missing semicolon, etc.
b. Logical Error: Logical errors are handled by programmers (Debugger tool)
Ex: Not reducing player health
c. Runtime Error: Runtime errors handled by programmers (Exception handling)
Ex: Array index out of bounds, divided by zero etc.

3. Warning Messages: Indicate may create problems later.
Ex: Variable initialized but not used.

Note:
You can not run the project if it has error message.
You can run the project if it has warning mesages.

IV. Understanding our First Script: [Starts At = 24min:27sec]
Example Program: To print Hello Unity in Console panel

using UnityEngine;
public class FirstScript : MonoBehaviour {
void Start () {
print ("Hello Unity");
}
}

public:
Access modifier makes the class available publicly (i.e. to unity engine)

class:
Everything should be part of a class in C#.

Colon symbol(:) = indicates extends in C#

MonoBehaviour:
As print, start and update methods are part of MonoBehaviour class,
We must extend our class with MonoBehaviour.
And
Convert our class as a component so that we can attach it to game object for execution

Proof for FirstScript class is a component class:
FirstScript : MonoBehaviour : Behaviour : Component

print : Logs message to Unity Console (Identical to Debug.Log)
Start : Start is called when a script is enabled just before any of the Update methods is called the first time.
Update : Update is called every frame, if the MonoBehaviour is enabled.

MonoBehaviour class is present inside UnityEngine namespace
Hence: using UnityEngine;

V. Understanding C# assemblies: [Starts At = 36min:00sec]
Assembly is a file that is automatically generated by the compiler upon successful compilation of every .NET application.
It is generated only once and updated on each compilation.

There are 2 kinds of assemblies in C#:
DLL (Dynamic Link Lirary) : collection of namespaces
DLL files are not self executable
To execute codes in DLL files we need to take help of some executable file
Example : mscorlib.dll, UnityEngine.dll

EXE (Executable) :
EXE files are self executable

Library:
Library is a collection of namespaces.
Namespace is collection of other namespaces and datastructures .
I.e. (Classes, structures, events etc.)