2.1 Introduction to C# Programming in Unity
2.1 Introduction to C# Programming in Unity
C# for Unity
Learning Objectives
2
• Setting Up Development Environment
• Introduction to Scripting
• C# Basics: Syntax and Structure
• Introduction to C#
• Basics of Unity Scripting in C#
Setting Up Development Environment
Unity supports the following IDEs:
• Visual Studio: When you install Unity on Windows and macOS, by default Unity also
installs Visual Studio or Visual Studio for Mac, respectively. By default, the External
Script Editor (menu: Unity > Preferences > External Tools > External Script Editor) is set
to Visual Studio
• Visual Studio Code: Unity supports opening scripts in Visual Studio Code (VS Code).
To open scripts in VS Code, go to Unity > Preferences > External Tools > External Script
Editor and select Visual Studio Code
• JetBrains Rider: Unity supports opening scripts in JetBrains Rider. To open scripts in
Rider, go to Unity > Preferences > External Tools > External Script Editor and select
Rider.
Debug.Log is a simple command that just prints a message to Unity’s console output. If
Play is pressed, the message should appear at the bottom of the main Unity editor window
and in the Console window (menu: Window > General > Console)
• Similarly, you can also output warnings by using the LogWarning method and errors with the
LogError method. These will prove to be useful for testing small bits of code without actually
having to implement them