Are you creating your first game in Unity, or your second or third, and want to learn or review some of the most commonly used features in one of the world's most established game engines?

Unity is a powerful tool widely used by indie studios, which operate independently of third-party investment, where players decide to become "owners of their own story" by developing their own projects.

The number of indie game-development studios has grown every year, while the tools have become increasingly powerful. Here, we will examine seven basic but indispensable tools, whether you are learning to create your own game or have been developing for some time. The article also explains how to use them.

1. NavMesh — How to Create AI Navigation (AI Navigation 2.0)

NavMesh is a Unity tool that maps navigable areas within a game environment, allowing artificial intelligence to automatically find the best route between two points, such as point A and point B.

It is ideal for creating movement systems for NPCs, or non-player characters, such as enemies in RPGs, patrols, vehicle traffic, and much more.

In Unity 6, the navigation system was improved with the AI Navigation 2.0 package, providing greater flexibility and control over agent movement in the game environment.

How do you use it?

🧩 Installing the Required Package

Before you begin, you need to install the package that activates Unity's navigation system:

  • Go to Window > Package Manager.
  • In the upper-left corner, change the filter to Unity Registry.
  • Search for AI Navigation.
  • Click Install.

This package provides all the tools needed to generate and use navigation maps, or NavMeshes, in your project.

🏗️ Preparing Environment Objects

Now you need to tell Unity which parts of the environment make up the "ground" where the AI can walk.

  • Select one or more objects, such as floors, streets, or platforms.
  • In the Inspector, select Navigation Static.
    This tells Unity that the object will not move and should be considered in the navigation calculation.
  • Important: only objects marked Navigation Static are included in the NavMesh calculation.

📐 Opening the Navigation Window and Generating the Map

  • Go to Window > AI > Navigation.
  • In the window that opens, go to the Bake tab.
  • There, you will find the main settings for the agent that will move around the map:
    • Agent Radius: how wide the character is, preventing it from passing through spaces that are too narrow.
    • Agent Height: the character's total height, preventing it from passing through low spaces.
    • Max Slope: the steepest incline the character can climb.
    • Step Height: the height of steps it can climb automatically.
  • Once everything is configured, click Bake.
  • Unity will generate a NavMesh, and the areas where the character can walk will appear colored blue in the scene.

🚶‍♂️ Preparing the AI-Controlled Character

Now you need to prepare the NPC, enemy, or AI-controlled character that will move across the NavMesh:

  • Select the character in the Hierarchy.
  • In the Inspector, click Add Component.
  • Add the component called NavMeshAgent.

This component is the character's navigation brain. It makes the character "know" how to move through NavMesh areas while avoiding obstacles.

💻 Moving the Character Through a Script

To make the character move to a specific point, use the NavMeshAgent's SetDestination() method. Here is a simple script example:

using UnityEngine;
using UnityEngine.AI;

public class MoveAI : MonoBehaviour
{
[Header("Settings")]
public LayerMask targetLayer; // Layer of objects that can be selected
public float detectionRadius = 100f; // Maximum raycast distance
private NavMeshAgent agent;
private Transform currentTarget;
private Camera cam;

void Start()
{
agent = GetComponent<NavMeshAgent>();
cam = Camera.main;
}

void Update()
{
// Continuous movement toward the current target
if (currentTarget != null)
{
agent.SetDestination(currentTarget.position);
}

// Click detection
if (Input.GetMouseButtonDown(0))
{
SetNewTargetByClick();
}
}

private void SetNewTargetByClick()
{
Ray ray = cam.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;

if (Physics.Raycast(ray, out hit, detectionRadius, targetLayer))
{
// Set the new target
currentTarget = hit.transform;
Debug.Log("New target set: " + currentTarget.name);
}
}
}

How to use this script:

  1. Create a new script called "MoveAI" and paste this code.
  2. Attach the script to the character with the NavMeshAgent.
  3. Create an empty object or marker where the character should go, for example, "DestinationPoint."
  4. In the Inspector, drag this object to the script's target field.

The character will now move automatically to the defined destination while avoiding walls and obstacles.

YouTube

2. Rigidbody — How to Create Physics in Your Game

The Rigidbody applies physics to objects, adding more layers of realism. It lets you apply force to movement, detect collisions accurately, and allow objects to react to gravity.

Rigidbody is one of Unity's most important components. It allows an object to obey the laws of physics, including gravity, collision, and force. An object can therefore fall, be pushed, hit another object, and move naturally without requiring you to animate everything manually.

Imagine a ball falling when you release it, or a box being pushed when a character touches it. Rigidbody handles that in Unity.

🛠️ How to Add Rigidbody to an Object

  1. Select the object in the Hierarchy, such as a sphere or box.
  2. Go to the Inspector, the panel on the right.
  3. Clique em Add Component.
  4. Type Rigidbody and select the component from the list.

Unity then automatically applies physics to the object: it begins falling, colliding with other objects, and being influenced by forces.

⚙️ Understanding the Properties

When you add Rigidbody, you will see several important options:

  • Mass: defines the object's weight. Heavier objects are harder to push.
  • Drag: defines resistance to movement, like friction with the air.
  • Angular Drag: resistance to the object's rotation.
  • Use Gravity: when selected, the object is pulled downward, enabling gravity.
  • Is Kinematic: when enabled, physics is ignored and you control movement manually through a script.

💥 How to Move the Object with Force (Push)

To apply a force, such as a kick or push, you can use a script:

csharpCopyEditRigidbody rb = GetComponent<Rigidbody>();
rb.AddForce(Vector3.forward * 10f);

This code pushes the object forward with a force of 10. You can use other directions such as Vector3.up, Vector3.left, Vector3.back, and so on.

🆕 Important: linearVelocity in Unity 6

If you want to set or check an object's velocity manually, the previous approach was:

csharpCopyEditrb.velocity = new Vector3(5, 0, 0);

Now, in Unity 6, the correct approach is:

csharpCopyEditrb.linearVelocity = new Vector3(5, 0, 0);

Unity changed velocity to linearVelocity to make the name more technical and consistent with the engine's other physics systems.

🎯 Complete Usage Example:

csharpCopyEditusing UnityEngine;

public class Ball : MonoBehaviour
{
Rigidbody rb;

void Start()
{
rb = GetComponent<Rigidbody>();

// Push the ball forward on start
rb.AddForce(Vector3.forward * 200f);
}

void Update()
{
// Press the space bar to push it upward
if (Input.GetKeyDown(KeyCode.Space))
{
rb.AddForce(Vector3.up * 300f);
}
}
}

This script can be used on a ball. When the game starts, it is pushed forward. When the player presses the space bar, the ball is launched upward.

YouTube

3. Animator and Animations — How to Animate Characters in Unity

Unity's animation system lets you bring your character to life: make it walk, run, jump, attack, die, and more, all in a controlled and fluid way without programming every movement manually.

The system uses animation states and transitions between them. You create "behavior logic" that determines when and how each animation should occur.

Unity uses a system called Mecanim, which organizes animations in a "state machine," the Animator Controller. Each state represents an animation, such as:

  • "Idle" (standing still)
  • "Walk" (walking)
  • "Jump" (jumping)
  • "Attack" (attacking)

You can automatically activate and deactivate these animations based on character actions or game events.

🎬 Creating or Importing Animations

Você pode:

  • Create animations directly in Unity for simple objects.
  • Or import ready-made animations in .anim, .fbx, .blend, and other formats.

Each animation defines what should happen to the object, such as how it moves or changes position over time.

🧠 Creating the Animator Controller

This is the "brain" that manages which animation should be active.

How to do it:

  1. Right-click in the Project panel.
  2. Go to Create > Animator Controller.
  3. Give it a name, such as PlayerAnimator.
  4. Select your character and, in the Inspector, drag the Animator Controller into the Controller field of the Animator component.

🔁 Adding and Configuring Animation States

  1. Double-click the Animator Controller you created.
  2. The Animator window will open.
  3. Drag the animations into the graph area. They become "blocks" called states.
  4. Right-click one of them and select Set as Default State, normally "Idle."
  5. Create transitions, shown as arrows, between states by right-clicking and choosing Make Transition.

🧩 Adding Parameters (to Control Animations)

In the Animator panel, go to the Parameters tab and click:

  • + Bool (e.g., isWalking)
  • + Trigger (e.g., jump)
  • + Float (e.g., speed)

These parameters work like switches that the script can turn on and off to change animations.

💻 Controlling Animations Through Code

Simple example:

csharpCopyEditAnimator animator;

void Start() {
animator = GetComponent<Animator>();
}

void Update() {
float movement = Input.GetAxis("Horizontal");

// Activate the walking animation if the player is moving
animator.SetBool("isWalking", movement != 0);
}

With this, the walking animation activates whenever the player presses a movement key. When the key is released, the character returns to the idle state.

This system lets you build complete animated behavior logic for any character. Best of all, you can do so without manually changing the animation every second. Unity handles it based on the parameters you define and control in code.

YouTube

4. Input System — How to Configure Player Controls

The Input System is Unity's system for handling player commands, such as pressing buttons, using a keyboard, mouse, controller, or even touching a mobile screen.

The current system is far more flexible and powerful than the old Input Manager, allowing controls to be configured visually and clearly across multiple devices without rewriting the code for each input type.

📦 Installing the Package

First, you need to activate the Input System in your project:

  1. Go to Window > Package Manager.
  2. Change the filter to Unity Registry.
  3. Search for Input System.
  4. Click Install.
  5. At the end, Unity may ask you to restart the project. Accept.

🎮 Creating the Input Actions Asset

The Input Actions Asset is where you define every command the player can use, such as "move," "jump," and "attack."

  1. Right-click in Project.
  2. Go to Create > Input Actions.
  3. Name your new asset, for example, PlayerControls.inputactions.
  4. Double-click it to open the visual editor.

In the editor:

  • Click + to add action maps, sets of actions such as Player and UI.
  • Inside an action map, click + to create actions such as "Move", "Jump", and "Attack".
  • For each action, define the bindings, or keys and buttons.
    For example, under "Move", add a 2D Vector binding and use WASD or Set Composite > Up/Down/Left/Right.

💻 Using It in a Script

After configuring the Input System, it is time to use the commands in code. Here is a simple movement example:

csharpCopyEditusing UnityEngine;
using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour
{
public InputAction moveAction;

void OnEnable()
{
moveAction.Enable(); // Start listening for input
}

void OnDisable()
{
moveAction.Disable(); // Disable it to avoid errors when the object is not in the scene
}

void Update()
{
Vector2 movement = moveAction.ReadValue<Vector2>();
Debug.Log("Movement: " + movement);
// Apply the movement to the character here
}
}

You can also generate an automatic class with ready-made controls by right-clicking Input Actions and selecting "Generate C# Class", making them even easier to use in code.

YouTube

5. Tilemap — How to Create Maps with 2D Tiles

Tilemap is one of Unity's best tools for creating 2D environments quickly and systematically. It lets you draw maps as though painting with blocks, or tiles, a technique common in retro games, RPGs, platformers, and Metroidvanias.

In this context, the map is essentially the environment of a 2D game. Instead of positioning every element manually, Tilemap provides a grid system where you can "paint" the environment using ready-made tiles such as floors, walls, grass, and water.

➕ Creating the Tilemap

  1. Go to GameObject > 2D Object > Tilemap > Rectangular.
  2. This automatically creates two objects in the Hierarchy:
    • An object called Grid.
    • A child object called Tilemap.

🔹 The Grid serves as the base and organizes tile positions.
🔹 The Tilemap is where you actually draw the map's tiles.

🎨 Creating the Tile Palette

To draw the map, you need to prepare a Tile Palette with the sprites you want to use.

  1. Go to Window > 2D > Tile Palette.
  2. Click Create New Palette and give it a name.
  3. Drag the sprites, such as a floor, wall, or grass sprite sheet, into the palette.
  4. Unity will ask you to save the tiles in a project folder. Choose or create a folder.

Done! The tiles are now available for you to use like a brush.

🖌️ Painting the Environment in Tilemap

With the Tile Palette open:

  1. Select the desired tile.
  2. Use the Brush Tool, represented by a brush icon, to paint directly on the Tilemap object visible in the Scene.
  3. You can also use the eraser, selection tool, fill tool, and more.

You can paint as many layers as you want, such as ground, decoration, and collision, by creating new Tilemap objects inside the same Grid.

🧱 Adding Colliders (for Interaction)

If you do not want the character to pass through certain tiles, such as walls, add:

  • Tilemap Collider 2D: detects collisions based on the painted tiles.
  • (Optional) Composite Collider 2D: improves performance by combining colliders.
  • Rigidbody 2D (marked Static): required for collisions to work correctly.

For a 2D character to collide with a wall, Tilemap needs these components to block movement.

Tilemap provides fast and orderly creation of 2D maps. It is ideal for games with large, repetitive maps, supports multiple layers such as ground, obstacles, and decoration, and offers excellent performance.

YouTube

6. ScriptableObjects — Storing Data in a Reusable and Organized Way

ScriptableObjects are an intelligent way to store data in a Unity project. They work like "configuration files" that you create in the editor, fill with information, and reuse wherever you want, without rewriting or duplicating code.

Imagine that you have several RPG items, such as a sword, potion, and shield, as well as enemies or spells. Instead of creating a new script for each one, you can create a template, a ScriptableObject, and then fill out each item as a separate file, all visually within the Unity editor.

📜 Creating the ScriptableObject Class

Create a new script that will work as a "data sheet." For example:

csharpCopyEditusing UnityEngine;

[CreateAssetMenu(fileName = "NewItem", menuName = "Inventory/Item")]
public class Item : ScriptableObject
{
public string itemName;
public Sprite icon;
}
  • itemName: the item's name, such as Fire Sword
  • icon: the icon shown in the menu or inventory

This script will not be attached to a GameObject; it is only a data structure.

📂 Creating Instances (Ready-Made Files in the Editor)

After creating the class, you can create multiple files with different data through Unity's menu:

  1. Right-click in the Project panel.
  2. Go to Create > Inventory > Item.
  3. Give it a name, such as "Fire Sword."
  4. With the new file selected, fill in the itemName, icon, and any other fields you defined.

You can create as many as you want, such as a "Healing Potion" or a "Golden Key."

🧩 Using the Data in Other Scripts

You can now use the ScriptableObjects anywhere in the game without typing everything again. Here is an example:

csharpCopyEditpublic class ItemSlot : MonoBehaviour
{
public Item item;

void Start()
{
Debug.Log("Equipped item: " + item.itemName);
}
}

In the Inspector, you will see a field where you can drag the ScriptableObject you created, such as "Fire Sword," and it will automatically load in the game.

ScriptableObject is ideal for inventory systems, enemies, spells, settings, loot tables, dialogue, and more. It is reusable and organized when data is properly separated from game logic, and it consumes less memory than similar tools such as GameObjects or MonoBehaviours.

YouTube

7. Raycast — Detecting What Is Ahead

A Raycast is like an invisible ray that starts at one point and travels in a specific direction, detecting everything it touches along the way. It is an essential technique for in-game interactions such as detecting obstacles, aiming at enemies, opening doors, or checking whether the player is looking at something.

It is ideal for interactions, shots, or sensors and works well in shooting games, puzzles, or interaction systems. Imagine using it to check whether an enemy is in a character's line of sight, let an AI detect something in its path, enable interactions such as "press E to open," or identify where a shot landed.

🔦 Raycast in 3D Space

This is the most common use in 3D games. Here is a basic example:

csharpCopyEditRaycastHit hit;

if (Physics.Raycast(transform.position, transform.forward, out hit, 10f))
{
Debug.Log("Hit: " + hit.collider.name);
}

What each part means:

  • transform.position: the ray's point of origin, normally the object that is "shooting."
  • transform.forward: the ray's direction, forward in this case.
  • 10f: the maximum distance traveled by the ray.
  • hit.collider.name: the name of the object hit.

This can be used, for example, to see whether the player is looking at a door button or to detect an enemy ahead.

🧭 Raycast in 2D Space

If your game is 2D, such as a platformer or top-down game, use Physics2D.Raycast. For example:

csharpCopyEditRaycastHit2D hit = Physics2D.Raycast(transform.position, Vector2.right, 5f);

if (hit.collider != null)
{
Debug.Log("Hit: " + hit.collider.name);
}
  • Vector2.right: the ray travels to the right.
  • 5f: the maximum distance.
  • hit contains information about the object struck, if any.

🛠️ Practical Raycast Tips

  • Interactions: use it to activate objects by pressing a key, "E," while looking at them.
  • Shooting and aiming: Raycast is excellent for simulating instantaneous bullets, as in an FPS.
  • NPC vision: you can use it to check whether the player is visible.
  • Debug: combine it with LineRenderer or use Debug.DrawRay() to visualize the ray in the scene.
  • LayerMask: use it to limit what the ray can hit, for example, only "Enemies" or "Interactive" objects.

❌ Note About Unity 6

The old Physics.RaycastNonAlloc() method was discontinued.
Now, use Physics.Raycast() with overloads that accept arrays, or simply use the standard model with RaycastHit.

Raycast lets your character or system accurately "sense" the surrounding environment without requiring visible physical collisions.

YouTube

Unity 6: Updates and Considerations

Now that we have completed this Eu, Brasileiro tutorial on basic Unity game-creation tools, let us review several changes, some already mentioned, that you may encounter between Unity 6 and earlier versions:

✔️ NavMesh: use the new AI Navigation system through Package Manager.
✔️ Rigidbody: use linearVelocity instead of velocity.
✔️ Animator: remains stable, with performance improvements.
✔️ Input System: remains the modern standard and is fully compatible with Unity 6.
✔️ Tilemap: the new Tile Set Assets tool makes painting and organization easier.
✔️ ScriptableObjects: feature integration improvements and simpler creation through the menu.
✔️ Raycast: RaycastNonAlloc is deprecated; use Raycast or RaycastAll carefully.

If you are studying game development to enter the industry, whether to create your own game from scratch or seek a job at a company, be sure to visit our jobs page. It includes openings at Frontiers Group Entertainment, the studio responsible for this site and other projects such as our game Eden's Frontier.