Unity Tutorial for Beginners. C Sharp in Unity. Image from Ackosmic Games

1. Setting the Environment

Before starting with the codes in C Sharp (C #), we will configure our Unity Editor Interface and thus ensure that we all see the same on the screen 🙂

Unity Tutorial Level: Beginner.

1.1 Creating a New Project.

We are going to create a new Project in Unity:

  1. Open Unity in your computer.
  2. On the home screen, click on the “New Button”.
  3. In the “Project name” field, write the name that you like most for your Project. We recommend “LearningCSharp”.
  4. In the “Location” field, select where you want to store your Project in your computer.
  5. Select the “2D” box.
  6. Finally, let's click on “Create project".

Unity Tutorial. Unity Home Image from Ackosmic Games

Once your Project is open, the Unity Editor Interface will look like this:

Unity Tutorial. Unity Editor Interface Image from Ackosmic Games

"Ads"

1.2 Organizing Windows.

Now we are going to modify the way in which the Windows are displayed within the Unity Editor Interface (in order to have a more comfortable working environment).

To do this, it is necessary to place our mouse pointer over the window´s name that we are going to move, then “click", "hold” and "drag" the window to the new location:

Our Unity Editor Interface should look like this:

Unity Tutorial. Unity Editor Interface Image from Ackosmic Games

Note: Do not worry if the Windows don´t arrange as you want or if one of them has been lost (or any similar disaster), it is always posible to leave everything as it was initially; you only have to click on the “Layout” button and choose “Default” from the list.

Unity Tutorial. Unity Editor Layout button Image from Ackosmic Games

Once the Windows are arranged as indicated in the previous image, we are going to save this arrangement so that we can call it again in case any window is accidentally lost. To do this, click on the “Layout” button and then choose “Save Layout…

Unity Tutorial. Unity Editor Layout button Image from Ackosmic Games

It will be shown a small window where we have to write the name of our arrangement (we recommend writing “CSharp_Layout”), then click on the “Save” button.

Unity Tutorial. Unity Editor Layout button Image from Ackosmic Games

"Ads" (the Ads Help us to Maintain this "Great Site" 😀 )

1.3 Creating Folders.

During the development of a video game, a large number of files (codes or scripts, media, program data, and more) are created and used; therefore it is always necessary to maintain a structure and an order for being organized with our information.

To achieve this, we will do so by using dedicated folders for each major group of files. Following the next steps:

  1. Inside the “Project” window, “right click” on the “Assets” folder and choose Create→Folder.

Note: The “Assets” folder is created by default with each Project that we start, and here is where Unity asks us to save all the files that we will use in our game (in other tutorials we will see that there are dedicated folders to other purposes with the ones we can also work).

Unity Tutorial. Unity Editor Project window Image from Ackosmic Games

2. A new folder is going to be created inside “Assets” and we will call this one “Scenes” (because this is the place where we will store our files that belong to the work scenes of our game).

3. Now, repeat step #1, in order to create the “Scripts” folder (here we will save all the C# code files or "Scripts" that we generate).

The “Project” window should show the following:

Unity Tutorial. Unity Editor Project window Image from Ackosmic Games

Note: The number of folders and their names may vary depending on the complexity of the Project and the people who develop it; for that reason, there is not a single structure that determines how to organize our files, we must organize them in the best way for our convenience.

"Ads" (the Ads Help us to Maintain this "Great Site" 😀 )

1.4 Saving the Scene.

The work scene ("Scene") in which we are working now, was created automatically when we opened this new Project. It is necessary to assign it a name and save it in order to start developing our video games (and avoid future problems):

  1. On the Menu bar, choose File → Save Scene as…

Unity Tutorial. Unity Editor Interface Image from Ackosmic Games

2. We will be asked to find the location where we want to save our Scene, as well as assign a name (the browser window of our operating system will automatically place us in the “Assets” folder of our Project). We recommend calling our Scene “CSharpScene” and saving it inside the “Scenes” folder that we had created.

Unity Tutorial. Unity Editor Interface Image from Ackosmic Games

Our Scene is ready to start working on it. One way to make sure that we are working on the correct scene is to verify the title of the main Unity Window (the Editor Interface), this title should indicate the name of the scene in which we are currently working, as well as the name of our Project.

Unity Tutorial. Unity Editor Interface Image from Ackosmic Games

Finally, we will save our Project to not lose our configurations, this can be done from the Menu bar, then choose File → Save Project (as a good practice, it is important to save our Scenes and the Project frequently).

Unity Tutorial. Unity Editor Interface Image from Ackosmic Games

Now we can close Unity without any problem and the next time we open our Project we will see all our last modifications.

"Ads" (the Ads Help us to Maintain this "Great Site" 😀 )

This Unity Tutorial about how to prepare our working environment ends here. Join us in the next post where we will begin programming in C Sharp (C#) Language.

Remember, if you want to know more about this topic, you can always visit Unity's online user manual at https://docs.unity3d.com/Manual/ or, do not hesitate to contact us for any questions or advice by clicking “Here”.

Next Unity Tutorial: 2. "Hello World" in Unity

Unity Tutorial: "C# in Unity"


1. Setting the Environment

2. "Hello World" in Unity

3. Knowing our Script

4. Variables Data Types

5. Operations with Variables

6. Conditionals

7. Arrays

8. Loops

9. Methods

10. Communication between Scripts

More Tutorials

"Ads"
Share this Post
Posted in CSharpAndUnity.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.