Asia/Jakarta
Posts

Unity Endless Runner Game

Unity Endless Runner Game
February 15, 2025
Who doesn't know endless runner games? From Temple Run to Subway Surfers, this genre has become one of the most iconic in mobile gaming. Simple mechanics — run, dodge, collect — yet endlessly addictive. But what if we could build one from scratch? This project is exactly that: creating a fully functional endless runner in Unity with C#, complete with procedural level generation, a collectible coin system, and an AI-driven eagle that hunts the player using a leader-follower behavior pattern.
  • The player runs automatically — the only control is dodging obstacles and collecting coins.
  • The level is procedurally generated at runtime, so it never ends and never repeats.
  • Old level sections are destroyed behind the player to keep memory clean.
  • An AI eagle system (leader + followers) chases the player dynamically.
  • The game ends when the player collides with an obstacle.
  • Distance traveled is tracked as the primary score metric.
This project is built entirely inside Unity with C# scripts organized into modular, single-responsibility components:
  • Engine: Unity
  • Language: C#
  • Paradigm: Object-Oriented Programming (OOP), Interface-based design
No external libraries required — just Unity Engine and pure C#. The full source code is available on GitHub. Feel free to view, download, or develop it further.
Bash
git clone https://github.com/Afrizal236/Unity-Endless-Game-Runner.git
Here's a quick demo of the game running in Unity, showcasing the procedural level generation, coin collection, and the AI eagle chasing the player:
  1. Open the project in Unity Hub
  2. Load the main scene
  3. Click the Play button
  4. Use the controls to move the character
This project is a solid foundation for a more complete game. Some features that could be added later:
  • Score UI and leaderboard system.
  • Sound effects and background music.
  • Improved visuals and polished assets.
  • Gesture or AI control integration.
  • Weapon or power-up system for added interactivity.
Building a game from scratch is one of the most effective ways to master software architecture, AI logic, and real-time systems all at once. Feel free to explore the project, run it in Unity, and extend it however you like.
On this page