No history yet

Unity Basics

The Unity Editor

Welcome to the Unity Editor, your command center for creating games. At first, it might look complex, but it's organized into a few key windows that you'll quickly get used to.

Lesson image

Think of it as a workshop. Each area has a specific purpose:

  • Scene View: This is your digital stage. You'll arrange your characters, props, and backgrounds here. You can fly around in this view to see your world from any angle.
  • Game View: This shows you exactly what the player will see through the game's camera. When you press the 'Play' button, this window comes to life.
  • Hierarchy: This is a list of every single item currently in your scene, like a cast and crew list for a movie. If you want to find your player character or a specific piece of scenery, you'll find it here.
  • Project Window: This is your library of assets. It holds all the files for your game that aren't in a specific scene yet, like images, sound files, and scripts.
  • Inspector: When you select anything in your scene or project, its properties and settings appear here. This is where you'll make adjustments, like changing a character's color or speed.

GameObjects and Components

Everything you place in a scene is a GameObject. The player, an enemy, a floating platform, the camera, a light source—they are all GameObjects. Think of them as empty containers or basic building blocks.

A GameObject on its own doesn't do much. It's just a thing that exists in your scene. To give it properties and behavior, you add Components.

Components are the functional parts you attach to GameObjects. One GameObject can have many components, and this combination defines what it is and what it does. Every GameObject must have at least one component: the Transform component, which determines its position, rotation, and scale in the world.

For a 2D player character, you might have:

  • A Sprite Renderer component to make it visible with a 2D image.
  • A Rigidbody 2D component to allow it to be affected by physics like gravity.
  • A Collider 2D component to let it bump into other objects.
  • A custom Script component you write to handle player input from a keyboard or controller.

Creating Your First 2D Scene

When you start a new project in Unity, you'll choose whether it's a 2D or 3D project. Selecting 2D sets up the editor with helpful defaults for 2D game development. For instance, any image you import will be treated as a Sprite, and the physics system will be set for 2D interactions.

Let's walk through setting up a simple scene.

  1. Create a Sprite: Find an image file (like a PNG) on your computer and drag it into the Project window. Unity will import it as a Sprite. Now, drag that Sprite from the Project window into the Scene View. This creates a new GameObject with a Transform and a Sprite Renderer component already attached.
  1. Adjust the Camera: The Scene starts with a Main Camera object. Select it in the Hierarchy. In the Inspector, you can change its Background color. You can also adjust its 'Size' property to control how much of the world it sees—a smaller size zooms in, and a larger size zooms out.
  1. Press Play: At the top of the editor, click the Play button. The Game View will activate, showing you your sprite against the background color you chose. This is your first running game scene!

From here, you can add more GameObjects and attach different components to build interactivity. This GameObject-Component relationship is the core concept behind all creation in Unity.