Unity is a cross-platform game engine used to create 2D, 3D, AR (Augmented Reality), and VR (Virtual Reality) games and simulations. It’s known for its flexibility, visual editor, and support for multiple platforms — PC, consoles, mobile, and the web.
| Component | Description |
|---|---|
| Scene | The environment or level of your game; contains all game objects. |
| GameObject | The basic unit in Unity — anything in the scene (player, camera, light, enemy, etc.). |
| Component | Behaviors or properties added to GameObjects (e.g., Rigidbody, Collider, Script). |
| Transform | Defines position, rotation, and scale of a GameObject. |
| Prefab | A reusable template for GameObjects. Great for enemies, bullets, etc. |
| Asset | External resources like textures, sounds, models, and scripts. |
| Tag and Layer | Used to identify or organize GameObjects in a scene. |
Language: Unity primarily uses C# for scripting.
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
void Start() {
// Runs once at the start
}
void Update() {
// Runs every frame
}
}
MonoBehaviour: The base class for all Unity scripts that interact with GameObjects.
Scenes can represent levels or menus. Prefabs allow you to instantiate multiple copies of GameObjects efficiently.
| Window | Purpose |
|---|---|
| Scene View | Design and edit your level. |
| Game View | Preview how your game will look when running. |
| Hierarchy | Displays all GameObjects in the current scene. |
| Inspector | Shows properties and components of selected GameObjects. |
| Project Window | Shows all assets in your project. |
| Console | Displays debug messages and errors. |
Unity can build your project for multiple platforms: