DeckStacker v1.0
A card manager plugin for Unity games.
 
Loading...
Searching...
No Matches
Setting Up A DeckStacker Scene
Stacks Demo Scene

DeckStacker provides a template scene for you, but let’s examine what is and is not required for this card system to work.

DeckStacker Scene Requirements

  1. UGUI
    • DeckStacker heavily leverages Unity’s UGUI system.
    • Whether it’s a World Canvas, or Screen Space, DeckStacker is pretty agnostic
    • If you want to use Unity’s traditional SpriteRenderers or even do something with Mesh Renderers, then…..well…….you’re on your own on how to get that working.
  2. Only 1 Canvas is supported
    • I am referring to “root” Canvases, and not sub-canvases (aka nested canvases)
    • This limitation is mostly due to standardized UI scaling, and getting input from the camera
  3. Only 1 instance of DeckStacker in the scene at a time
    • There are multiple static classes that are being used to simplify things, and streamline the setup.
  4. The DeckStacker Canvas needs to have a DSUIScaleUpdater attached to it (see below)
    • This handles UI scaling and camera input
  5. An object in the scene needs to have a DSTableRunner component enabled (see below)
    • This object will run some core Update and LateUpdate loops in DeckStacker static scripts.

DeckStacker Hierarchy Setup

Scene Hierarchy

However you setup your scene, there are 2 important components that need to be present for any Stack or Card to do its work:

DSUIScaleUpdater

The root Canvas (referred to in the code as the “Universal DeckStacker Canvas” due to it being the 1 true Canvas that is allowed) will need to be referenced by a DSUIScaleUpdater.

As previously mentioned, this will handle UI scaling, dynamically (adjusting for screen size changes, as well), as well as getting mouse input from the Canvas’s camera.

DSTableRunner

An object in the scene will also need to have the DSTableRunner component. No other setup is required, but it is critically important that this object exists in the scene. Without it, nothing will work, since the Update loops that drive DeckStacker will immediately halt.

If you want to disable DeckStacker, for any reason, you can pretty much just disable this component…

Beyond that…

…That’s pretty much it. Start dropping in Stacks, spawn some cards, and start queueing up some actions and you are off to the races on making a game.

Be sure to study the Example Projects for various ways of using DeckStacker. I have to warn you, though: These projects may not be as well documented and commented as the core DeckStacker code…