Set Player Start Position with C# in Unity (part 1)
Create a new folder for your scripts in the Project panel in Unity. Then , create a new script by right-clicking and choosing ‘Create/C# Script’ from the menu. Also, be sure to name the script while its name is still highlighted. The we will be using is ‘Player’. The script and class of the script need to have the same name. If you create the script now and then decide later to rename it, you will have to open the script and change the name of the class to match the name of the script. It is simply easier to do it now at the time of creation of the script.

Here is a comparison of the script name and class name in Unity and in Visual Studio, the IDE that we are using with Unity in this tutorial.

Double click the script in Unity to open it in Visual Studio. This is what you should see.

Lets explain some of what is seen here.
The first three lines are name spaces. These are like libraries of functionality which, when named here, give you access to those functionalities. Monobehaviour is functionality that is contained in the namespace UnityEngine, as well as ‘void Start’ and ‘void Update’.
void Start is at the head of code that is run when the game is started. It is run just that one time.
void Update would can contain code that is executed every time the game updates. The default is 60 times per second.
An example would be that initial conditions would go under Start and updated player and enemy positions would go under Update.
You can now attach your new script to the player by dragging it onto the Player object in the hierarchy panel. The script will then be a component in the Inspector panel for the Player object.

Now that the script is a component of the Player object, you can access its position with code. In the next tutorial we’ll go over those methods and, as well, how to change the position of the player.