Skip to main content
‹ Back to Tutorials
Intermediate Unity

Coding a Game in Unity with ChatGPT in Just 1 Hour!

Jul 24, 2023
About this tutorial

In this 1-hour coding challenge, I use ChatGPT to code and rapidly develop a simple game in Unity. Join me as I push ChatGPT to its limits and try to go from zero to a complete, playable game in only 1 hour! My discord link ► https://discord.gg/DgUdNDT7KU ► Download Unity at https://unity.com Cha

Written Guide

Can you build a playable Unity game in one hour using ChatGPT for every line of code? This video documents the experiment in real time. The result is a color-switching hyper-casual game — and a realistic picture of where AI-assisted game development shines and where it eats your clock. Here's what was built and what the experiment showed.

The setup

The challenge rules: one hour on the clock, ChatGPT writes all the code, no hand-written scripts. The first decision was scope — from a shortlist of hyper-casual formats (tap-to-avoid, one-tap jumping, Fruit Ninja clone, one-touch drawing), the color-switching genre won: simple rules, clear win/fail condition, and small enough to be achievable in an hour.

Unity setup took minutes: switch the main camera from perspective to orthographic projection (which flattens the view for 2D-style gameplay) and install the 2D package from the Package Manager.

Building the core loop with ChatGPT

The game came together as a series of plain-English requests to ChatGPT, each producing a script: spawn objects at the top of the screen that move downward; change the player sphere's color on screen tap; detect when a spawned object touches the player; and compare colors on contact — matching colors pass safely, mismatches mean failure. Each generated script went straight into Unity, with quick play-tests between requests confirming the behavior before moving on.

That iteration rhythm — ask, paste, test, refine the request — turned out to be the real skill. The clearer and more specific the prompt ("in the player script, detect if one of the enemies has touched the player"), the better the code that came back.

Score, sound, and polish

With the core loop working, the remaining time went to game-feel: a score counter UI that increments each time the player passes a gate, a click sound on every screen tap, and background music — using free sound assets. None of these required fighting ChatGPT; UI and audio hookup requests are well-trodden ground for it.

The verdict

The hour ran out just short of a fully finished game — but the result was a playable core loop with scoring and sound, built from zero by someone directing an AI rather than typing code. Two honest takeaways from the experiment: ChatGPT is remarkably fast for boilerplate and standard mechanics, making it a genuine prototyping accelerator; and the developer still does the design work — choosing scope, sequencing features, testing, and catching integration issues. AI wrote the code, but the game-development thinking remained fully human.

Transcript
Show / hide transcript (31 segments)
0:00 hey in this game development experiment I'm giving myself one hour to use chat
0:05 GPT for all the coding for a game and then I'm going to be creating a game
0:10 within Unity so if you're ready come along for the journey let's go
0:14 okay so here I am in chat gbd let's go ahead and get started so I want to
0:18 create a hyper casual game
0:26 okay so we're gonna hopefully try to keep this something simple tap to avoid
0:30 One Tap jumping color switching and Fruit Ninja clone and One Touch Drawing
0:35 okay so I'm going to try maybe doing the color switching game and a 3D game but I
0:42 can go ahead and actually use this for a 2d game as well so the only main
0:47 difference between a 2d game and a 3D game is really the main camera so I'm
0:51 going to select the main camera we're going to change this from a perspective
0:54 to an orthographic projection so what that does it just makes everything flat
0:59 and it sees everything flat I need to also import some package manager that is
1:05 my 2D assets so we're going to import the 2D package we're going to install
1:09 that now what I want to do is we want to
1:13 generate game objects on top of the screen that are going to move down and
1:18 we want to be able to touch the screen to change the color of our sphere okay
1:23 so we need to go ahead and create some scripts for that
1:53 okay so the next thing I want to do here is to detect if the player does touch
1:59 one of those spawned objects so
2:04 okay so what I'm telling it to do here is to in the player script detect if
2:10 one of the enemies has touched the player
2:17 yeah so it's telling me that it is hitting those game objects which is
2:21 perfect okay so now the next thing we need to do is to detect to see if the
2:26 spawned object is the same color as the player
2:41 so those are the same colors shouldn't give us any error there we have a color
2:45 change and it gets exact it's doing exactly what we ask you to do cool okay
2:51 so the next thing I want to do is every time I pass one of those walls that we
2:57 continue I want to be able to add to scores so I need to create a UI for that
3:38 UI klikoni
4:17 klikohet ekrani
Unity tools by Bliz Studio
Built for our own games — now on the Asset Store

Multi Tag — unlimited hierarchical tags for any GameObject. Hierarchy Pro — style your whole hierarchy with rules. Made by a Unity dev, for Unity devs.

Explore our Unity assets →