Video summary

Build A Complete Android Game Today - Unity Android Tutorial

Main summary

Key takeaways

Technology

Summary of the Video (Unity Android Tutorial): “Block Dodge” Game Build (Start to Finish)

This tutorial walks through building a simple 2D Android game in Unity where the player controls a character (a pig) to dodge falling blocks, avoids collisions, and the game restarts on impact. It covers the full workflow: setting up Unity for Android, scene setup, physics/colliders, scripting movement/spawning/collision/game UI/score, and finally building an APK.


End Goal / Gameplay Loop

  • “Block Dodge” endless runner-style game:
    • Player taps left/right to move.
    • Blocks continuously spawn at random X positions above the screen and fall downward.
    • If the player collides with a block, the scene reloads (game restarts).
    • Score increases (tied to the block spawning logic described).
    • A “Tap to Start” screen gates the start of spawning and score display.

Unity + Android Project Setup

  1. Create a new Unity project

    • Use the 2D template.
  2. Install Android build support

    • Unity Hub → Installs → gear icon → Add modules → install Android build support.
  3. Switch build target

    • File → Build Settings → select AndroidSwitch Platform.
  4. Configure resolution

    • Game view aspect set to 16:9 portrait (and mentions other portrait resolutions like 1080×1920).

Scene Organization and Assets

  • Rename the default scene to game.
  • Create folders:
    • Sprites
    • Scripts
    • prefab
  • Import/download 2D sprites (example sources mentioned: kenny.nl, gamers2d.com, plus self-made assets).

Core Scene Objects and Configuration

1) Ground (tiled)

  • Add ground tile sprite into the scene.
  • Rename to ground.
  • In Sprite Renderer, set Draw Mode to Tiled.
  • Position ground so the visible area matches mobile framing.

2) Player (pig)

  • Drag in a pig/player sprite (named player).
  • Fix rendering order:
    • Set Sprite Renderer sorting layer/order so pig appears in front of crown.
  • Add physics:
    • Rigidbody2D
      • Gravity scale: 0 (player shouldn’t fall).
      • Freeze rotation (freeze Z; optionally freeze Y position).
    • BoxCollider2D
      • Adjust collider size via Edit Collider.

3) Camera background

  • Set camera background color (e.g., a “sunny sky color”).

4) Blocks (obstacles)

  • Create a block object using a sprite (great object/obstacle).
  • Add:
    • Rigidbody2D
    • BoxCollider2D
  • Create a Tag named block and assign it to obstacles.
  • Test: blocks fall due to gravity.

Scripts Created (C#)

The tutorial creates separate scripts for:

  • Block (destroy logic)
  • Player (movement + collision restart)
  • GameManager (spawning + score + start gating)

Block script: destroy when off-screen

  • In Update:
    • If block’s position.y goes below a threshold (example: < -6f):
      • Destroy(gameObject)
  • Purpose:
    • Prevent clutter/performance issues from infinite blocks.

Player script: tap-to-move + restart on collision

Movement inputs

  • Uses touch/mouse input:
    • Input.GetMouseButtonDown(0) and Input.mousePosition
  • Converts screen coordinates to world coordinates:
    • Camera.main.ScreenToWorldPoint(...)
  • If tap is on the left side (touchPose.x < 0):
    • Move left via Rigidbody2D.AddForce
  • If on the right side:
    • Move right via Rigidbody2D.AddForce
  • When not touching:
    • Set velocity to 0 (rb.velocity = Vector2.zero)

Boundaries

  • Prevent moving off-screen by building left/right “walls” using empty objects with BoxCollider2D.

Collision restart

  • Implements OnCollisionEnter2D
  • If collided object has tag block:
    • Reload the scene:
      • SceneManager.LoadScene(0) (or by scene name)

GameManager script: spawn blocks + start on first tap + score UI

Scene objects / references

  • public GameObject block (prefab to instantiate)
  • public float MaxX (random spawn range on X)
  • public Transform spawnPoint
  • public float spawnRate
  • bool gameStarted initially false

Spawning

  • Spawns at random X positions:
    • spawn position uses spawnPoint.position
    • random X between -MaxX and +MaxX
  • Repeats instantiation:
    • Uses InvokeRepeating("spawnBlock", 0.5f, spawnRate)

Start gating

  • In Update, on first tap:
    • if Input.GetMouseButtonDown(0) and !gameStarted:
      • call startSpawning()
      • set gameStarted = true

Score + UI

  • References UI objects:
    • “Tap to Start” text/image (disabled when game starts)
    • TextMeshPro score text (updated in code)
  • int score = 0
  • Score increases (tutorial indicates increasing during spawn with score++)
  • UI updated:
    • scoreText.text = score.ToString()

UI Setup (Tap to Start + Score)

  • Adds TMP (TextMeshPro) using “Import TMP Essentials”.
  • Tap to Start graphic/text:
    • Adjusts sprite import settings:
      • Sprite Mode set to Single
    • Converted into a UI element (Canvas → UI Image) so it scales properly across devices.
  • Score Text
    • TMP text set to large font size (example ~300)
    • Positioned top-center
    • Initial value set to 0
  • GameManager disables the Tap-to-Start UI when gameplay begins.

Title text (optional “cooler” step)

  • Creates a title image (“Block Dodge”).
  • Makes the title a child of the Tap-to-Start UI object so it disappears together when the game starts (and reappears on reset, consistent with the logic).

Testing Workflow

  • Tests using Unity Device Simulator:
    • Example device: Google Pixel 5
  • Gameplay verified:
    • Player responds to touch movement.
    • Blocks spawn randomly.
    • Blocks destroy off-screen.
    • Collision triggers restart.
    • Tap-to-start works.

Building the Android APK

  • File → Build Settings

    • Ensure the correct scene is added (the game scene).
  • Player Settings

    • Set company/product name (example: Charger games)
    • Set game icon
    • Set version number
    • Ensure package name is set (must be specified to export)
    • Choose target architecture / Android version as desired
    • Disable auto rotation to lock portrait orientation
  • Build output

    • Creates an output folder (example: “Android build”)
    • Saves APK (example name: “Pick Dodge big dodge”)
  • After several minutes, APK is produced for installation on a device (USB/email/Drive).

Main Speakers / Source

  • Speaker: Raja (also identified as “Raja from Charger games”).

Original video