Learning C# and Unity works best when you code a little every day instead of cramming. This 21-day challenge gives you one small, concrete task per day so you build a habit and finish with a tiny playable game. No prior Unity experience required; if you have never written C#, you will learn the basics as you go.

By day 21 you will have used variables, methods, physics, input, UI, and scenes so the skills stick. You can do each day in 15–45 minutes depending on how deep you go.


How the challenge works

  • One task per day. Each day has a single goal (e.g. "Move a cube with keyboard," "Add a score counter").
  • Use Unity and C#. Install Unity Hub and create a new 2D or 3D project. We use C# in the examples.
  • Build on the previous day. Days stack: day 1 is a scene and a script; by day 21 you have a minimal game with movement, scoring, and a simple win/lose state.
  • Share if you want. Post progress with #21DayUnityChallenge or in your favorite Unity Discord. Accountability helps.

If you miss a day, pick up the next one; the order matters but strict timing does not.


Days 1–7: Setup and basics

Day 1 – New project and first script
Create a new Unity project (2D or 3D). Add a Cube (or Sprite) to the scene. Create a C# script, attach it to the object, and use Debug.Log("Hello"); in Start(). Run the game and see the message in the Console. You have just run your first C# in Unity.

Day 2 – Variables and the Inspector
In the same script, add a public float speed = 5f;. In Update(), write transform.Translate(speed * Time.deltaTime, 0, 0);. Press Play; the object moves. Change speed in the Inspector and run again. You have used a variable and seen how the Inspector and C# connect.

Day 3 – Input (keyboard)
Use Input.GetAxis("Horizontal") and Input.GetAxis("Vertical") to move the object left/right and up/down. Store the result in a Vector3 and apply it with transform.Translate(...) or by changing transform.position. Your object is now player-controlled.

Day 4 – Rigidbody (physics)
Remove the direct transform movement. Add a Rigidbody (or Rigidbody2D) to the object. In FixedUpdate(), use Rigidbody.AddForce() or Rigidbody.velocity to move from input. Get used to physics-driven movement; it is the norm for most games.

Day 5 – Colliders and tags
Add a second object (e.g. a "collectible") with a Collider. Give it a Tag like "Collectible." In your player script, use OnCollisionEnter (or OnTriggerEnter) to detect contact. When the player touches the collectible, call Destroy(other.gameObject) and use Debug.Log to confirm. You have basic collision and tags.

Day 6 – A simple UI text
Add a Canvas and a Text (TextMeshPro or legacy UI Text). In your script, add a public Text scoreText; (or TMP_Text), assign it in the Inspector, and in code set scoreText.text = "Score: " + score;. Increment score when you collect something (day 5). You now have an on-screen counter.

Day 7 – Scenes and build
Create a second scene (e.g. "GameOver"). Use SceneManager.LoadScene("GameOver"); when the player wins or loses (e.g. when score reaches 5 or when they hit an obstacle). Add both scenes to Build Settings. Run a build and confirm the scene change works. You have multi-scene flow.


Days 8–14: Polish and structure

Day 8 – Timer
Add a float timer that increases by Time.deltaTime each frame. Display it in UI. Optionally end the game when the timer hits 60 seconds. You have a simple game timer.

Day 9 – Restart and main menu
Add a "Restart" button in the game-over scene that loads the game scene again. Add a simple main menu scene with a "Play" button that loads the first game scene. You have a minimal flow: menu, play, game over, restart.

Day 10 – Sound (optional)
Add an AudioSource to the player or camera. When the player collects an item, play a clip with AudioSource.PlayOneShot(clip);. Use a free sound from Freesound or Kenney. You have basic audio feedback.

Day 11 – Prefabs
Turn your collectible (and any repeated object) into a Prefab. Place several instances in the scene. Change the prefab and see instances update. You have started reusing content with prefabs.

Day 12 – More C# (lists and loops)
Use a List<GameObject> to track collectibles or a list of spawn points. Use a for or foreach loop to iterate. Optionally spawn collectibles from the list at random positions. You have used collections and loops in a game context.

Day 13 – Simple enemy or obstacle
Add an object that moves on its own (e.g. back and forth) or that the player must avoid. On collision, reload the game scene or subtract a life. You have a basic obstacle or "enemy."

Day 14 – Polish and tweaks
Spend the day tuning: adjust speeds, sizes, UI text, and difficulty. Fix one small bug. Get the game to feel a bit better. You have practiced iteration.


Days 15–21: One small game

Day 15 – Win and lose conditions
Define clear win (e.g. collect 10 items) and lose (e.g. hit 3 obstacles or run out of time) conditions. Load the correct scene and show a simple "You Win" or "Game Over" message. You have a full loop.

Day 16 – High score (PlayerPrefs)
Save the best score with PlayerPrefs.SetInt("HighScore", score) when the player wins, and load it with PlayerPrefs.GetInt("HighScore", 0) to show on the game over or main menu. You have persistent data.

Day 17 – Simple animation or feedback
Add a small animation (e.g. scale or rotation on collect) or a particle effect when the player collects something. Use the Animator or simple transform tweens in code. You have added juice.

Day 18 – Multiple levels (optional)
Duplicate your game scene, change layout or difficulty, and load "Level2" when the player beats level 1. Optionally use a build index: SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);. You have a second level.

Day 19 – Code cleanup
Refactor one script: extract magic numbers into named constants or Inspector variables. Add short comments. Split one long method into smaller ones. You have improved readability.

Day 20 – Build and test
Build for PC (or Mac) and play from the executable. Test with a friend or post a short clip. Note one thing to fix. You have shipped a build.

Day 21 – Reflect and plan next steps
Write down three things you learned and one thing you want to learn next (e.g. "I want to add a main menu with options"). Bookmark a Unity tutorial or our Unity guides for your next project. You have completed the challenge and have a path forward.


Tips for sticking with it

  • Same time each day. Even 15 minutes at a fixed time builds the habit.
  • One task only. Do not add extra features; finish the day's goal and stop if you are short on time.
  • Use the official docs. Unity Scripting Reference and C# docs are your friends when stuck.
  • Join a community. Share progress in a Discord or forum; it keeps you accountable and you get quick help.

FAQ

Do I need prior programming experience?
Helpful but not required. If you are new to C#, focus on days 1–7 and use the code snippets as given; you will pick up syntax as you go.

Can I use Unity 2D instead of 3D?
Yes. Use Rigidbody2D, Collider2D, and 2D sprites; the same logic (variables, input, collision, UI) applies.

What if I fall behind?
Resume from the day you left off. The goal is consistency over time, not perfect 21 consecutive days.

Can I do the challenge more than once?
Yes. Repeat with a different small game (e.g. a shooter or a puzzle) to reinforce the same patterns.

Where can I get assets and sounds?
Use Kenney or OpenGameArt for free placeholders; see our free game assets list for more.


You now have a full 21-day plan. Start with day 1, keep the scope small, and by day 21 you will have a playable mini-game and a solid base in C# and Unity. For more structured learning, check out our Unity courses and game development guides. Found this useful? Bookmark it and share the challenge with others who want to master C# for Unity.