Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Unity Card Battler: Code a Deck-Building Card Game in C#
Hot & New
New
Rating: 5.0 out of 5(5 ratings)
389 students
Last updated 5/2026
English

What you'll learn

  • Build a fully playable PvE card battler in Unity 6 with a working deck, hand, discard pile and turn-based combat system.
  • Use ScriptableObjects to create a data-driven card system where one prefab renders every card in the game.
  • Decouple gameplay systems using Unity Events so damage, sound, animations and turn management respond without tangled dependencies.
  • Implement drag-and-snap card movement, hover scaling and correct card ordering across deck, hand and discard pile.
  • Build a deck builder scene where card selections persist into combat - the deck you build is the deck you fight with.
  • Create a turn-based loop with player and boss turns, health bars, action locking, and Fisher-Yates shuffle.

Course content

4 sections46 lectures6h 17m total length
  • Welcome to the Course1:22
  • Unity Setup2:02

    Installing the proper version of unity and creating the project.

  • Constructing a Card12:46

    Creating a visual card prefab from a collection of modular sprites.

  • Data-driven Cards9:58

    Making our card to be data-driven using ScriptableObjects, and talking about the advantages of doing so.

  • Community & Support1:33

    We introduce the ways that you can get help, support and contribute to the community.

  • Accessing Our Projects4:38

    Any time we change our project during a lecture we will commit that change to a public source control repository for students to access. In this video, we show you how to access that content.

  • Deck & Drawing4:10

    Creating the basic for our deck and a basic function to draw cards.

  • Deck Visuals6:45

    Adding a card back and a way to stack them up in our deck to visually represent the amount of undrawn cards.

  • Card Hovering View9:33

    Creating a hover functionality which expands the card view, like it’s being inspected.

  • Player Hand14:20

    Building a visual player hand and a corresponding script to hold cards and dynamically draw them.

  • Shuffling5:46

    Adding a shuffle function and explaining the Fisher-Yates shuffle algorithm.

  • Dragging & Snapping10:06

    Learn how to make cards follow mouse with click and drag, and how to make them properly snap back into position.

  • Playzone7:27

    Creating a basic play zone to respond to cards, and explaining GetComponent vs TryGetComponent.

  • Discarding14:56

    Adding a discard pile to our scene along with discarding functionality and stacking visuals.

  • Locking the Discard Pile3:48

    Locking the discard pile from interaction and fixing a bug created from discarding.

  • Repositioning6:18

    Adding click to draw plus repositioning of the player’s hand upon drawing and discarding cards.

  • Section Cleanup13:21

    Some project and scene cleanup to wrap up the section.

Requirements

  • Intermediate Unity and C# skills - you should be comfortable creating scripts, using the Inspector and navigating the editor.
  • A working understanding of object-oriented programming: classes, objects, inheritance and encapsulation.
  • VSCode or another code editor installed and ready to use.

Description

Love card games like Slay the Spire? This is the course for you.

You'll build a fully playable PvE card battler in Unity 6, complete with a working deck, a player hand that feels good to use, and a turn-based system that pits you against a boss who hits back.

"I want to build a card game. But how do all the pieces actually talk to each other?"

If you've ever stared at a blank Unity scene wondering how a card game is supposed to work without turning into spaghetti, you're in the right place.

Card battlers are one of the most satisfying genres to build, because every system connects. Drawing cards, triggering effects, managing turns, building combos. When it all clicks, it feels like magic. But get the architecture wrong early and you'll spend more time untangling code than making a game.

This course shows you the right way to build it from the start.

You'll use ScriptableObjects to make every card data-driven, and C# Events to keep your systems clean and extensible.

Then you'll go further. A full deck builder scene lets you browse your card collection and customise your deck, and those changes carry through into combat. The deck you build is the deck you fight with.

And then there's the moment it all comes together.

You drag a card onto the field. A sound fires. A visual effect plays. The card slides to the discard pile. Your boss reacts. You built every piece of that, and you know exactly how to do it again.

Enrol now and build your card game.

Who this course is for:

  • Intermediate Unity developers who want to build a sophisticated project and learn scalable, event-driven architecture.
  • Game developers who love card games like Slay the Spire and want to build their own from scratch.
  • Unity developers working on turn-based games who want to structure their code properly from the start.