Skip to main content

Database Management

Guide

GameCardManager registers all six GCS database types in one place, and the Active set determines which content Game Card Editor and GCSApi can discover

GameCardManager defines the content discovery scope

A card, deck, or encounter asset does not enter the current scene's authoring and query scope merely by appearing in the Project window. Game Card Editor and GCSApi can discover it only when its database is registered with the scene's GameCardManager and remains Active. When starting from an empty scene, use the following menu to open the Game Card System Dashboard, then click Initialize System:

Tools > TinyGiants > GCS > Game Card System

The first initialization creates GameCardManager and GameCardEncounterBootstrap, then registers all six preset databases as Active. On later initialization runs, the database step only restores missing preset entries. It does not remove project databases or reactivate presets that were set to Inactive. Select GameCardManager in the Hierarchy to see the registrations, Active count, and content count for all six database types in the Inspector:

The six preset database types in the Game Card Manager Inspector, each showing 1/1 Active with New, Add, locate, and remove operations

The six sections above manage Card, Deck, Player Unit, Enemy Unit, Status, and Encounter databases. 1/1 Active means that only one database is registered for that type. Each section also keeps creation, registration, and routine maintenance together. The following diagram shows how database discovery and activation work:

The first path controls whether GCS can enumerate database content actively. The other preserves Unity direct references already assigned to decks, players, and encounters.

Entity selector fallback rules

The Database dropdown at the top of Game Card Editor lists only Active databases.

Entity selectors for cards, units, statuses, and encounters prefer Active content. When the scene has no Manager, or when all Active databases contain no entries of that entity type, the selector falls back to a project-wide search. Seeing an item in a selector therefore does not prove that its database is currently Active.

Six database types form one battle

After registration and activation, each database appears in the corresponding Game Card Editor mode. Membership is defined by the entries recorded inside the database. Moving an asset into a same-named folder does not add it to the database.

DatabaseEditor modeStored contentResponsibility in battle
GameCardDatabaseCardCardsCost, target, tags, upgrades, and Card Behavior
GameDeckDatabaseDeckDecksCard entries, copy counts, starting decks, and reward pools
GamePlayerUnitDatabasePlayerPlayer UnitsHP, energy, starting deck, and player presentation assets
GameEnemyUnitDatabaseEnemyEnemy UnitsHP range, tier, Intent, Behavior, and enemy presentation assets
GameStatusDatabaseStatusStatusesBuffs, Debuffs, stacking, decay, Hooks, and Status Behavior
GameEncounterDatabaseEncounterEncountersPlayer, enemy lineup, Battle Rules, and reward deck

These six content types are not isolated lists. A battle usually expands downward from GameEncounter: the Encounter selects the player, enemies, rules, and reward deck; the player connects a deck through Starting Deck; and the deck connects cards through its entries. FlowGraphs on cards, enemies, and statuses eventually execute in the same battle. Runtime Data Model explains how definitions create independent battle instances. FlowGraph Model explains how Behaviors read and modify those instances.

When you select a database asset in the Project window, its dedicated Inspector shows statistics for the content it contains. For example, GameCardDatabase presents the total card count, types, and rarities in one Summary:

The dedicated Preset Card Database Inspector showing the asset path, card type and rarity statistics, and Open in Card Mode

Click Open in Card Mode to open the current card database directly in Game Card Editor. The other database Inspectors provide the corresponding mode shortcut.

tip

All six Inspectors show the asset path and total content count. Enemy Database also groups counts by Tier, Status Database separates Buffs and Debuffs, and only Card Database reports Type and Rarity.

Create and register project databases

Preset databases provide runnable content structures to inspect. Your own project databases should live outside the plugin directory. When you create one with + New, the default root is Assets/TinyGiantsData/GameCardSystem/.

TypeDefault directory for + New
CardCardDatabases/
DeckDeckDatabases/
Player UnitPlayerUnits/
Enemy UnitEnemyUnits/
StatusStatusDatabases/
EncounterEncounterDatabases/

Every database section in the Manager Inspector provides the same operations.

OperationResult
+ NewCreates a database in the corresponding project data directory, registers it immediately, and sets it Active
+ AddLists unregistered databases of the same type in the project, then registers the selected database and sets it Active
Drag and dropRegisters one or more databases of the same type from the Project window. The same asset is never added twice
ActiveControls whether the database belongs to the active discovery scope of the current Manager
LocateSelects the database asset in the Project window
RemoveUnregisters the database from the current Manager without deleting it from disk
Double-click nameRenames the database asset file directly

You can also create a database directly in the target Project directory, then return to the Manager and register it with + Add or drag and drop:

Assets > Create > TinyGiants > GCS > Card Database

After registration, open Game Card Editor, switch to the matching content mode, and select the Active database from the Database dropdown at the top.

A complete project-database workflow follows this order:

  1. Use + New in the matching GameCardManager section, or use + Add to register an existing database.
  2. Confirm that the database row is Active and check the Active count in the section heading.
  3. Open Game Card Editor and switch to the matching content mode.
  4. Select the target database from the Database dropdown.
  5. Create content and confirm in the database Inspector or Editor list that the entry was written to the correct location.
Deletion boundaries
  • The remove button on a Manager row only unregisters the database. Delete in the Project window removes the database file and all of its content sub-assets.

  • After a database is deleted, direct references from decks, players, or encounters can become Missing. Check references before deletion.

Use Active sets to separate Demo, production, and test content

Active state belongs to the current GameCardManager, not to the database asset. The same database can remain Active in a Demo scene, stay registered but Inactive in a production scene, and be enabled only in a dedicated test scene.

Separation dimensionDatabase exampleActive strategy
Content sourcePreset and project databasesEnable project databases in production scenes and enable presets temporarily only for comparison
ClassWarrior, Mage, Hunter, PriestEnable only the class content needed for the current authoring or query mode
ActAct 1, Act 2, BossExpose the content set required by the current scene or game mode
Test scopeMechanic-validation and production databasesEnable test databases only in validation scenes so they do not enter production query results

Once each scene maintains its own Active set, the databases available in Game Card Editor, the content returned by GCSApi, and the GUID lookup scope all change with the scene. Demo, production, and test scenes no longer share the same active discovery results.

Current multi-database boundaries in FlowGraph
  • GCSApi merges every Active database of the same type, but the current battle execution context uses only the first Active database in Manager registration order when resolving status, card, and enemy IDs.
  • Change Status and Spawn Unit are both limited by this boundary. Transform Card is limited only when it resolves the New Card field. Add Cards follows the same rule only when its Cards input receives no CardInstance and the node falls back to its inline Cards selector.
  • When using these inline content fields, place the target status, card, or enemy in the first Active database of the corresponding type. These nodes do not search across databases automatically, even when several Card, Status, or Enemy Unit Databases are Active.

Read the same content from code

The Database dropdown in Game Card Editor and GCSApi use the same Active databases from the current Manager. Code can read all six database types or retrieve all of their content directly:

using TinyGiants.GCS.Runtime;

var cardDatabases = GCSApi.ActiveCardDatabases();
var deckDatabases = GCSApi.ActiveDeckDatabases();
var playerDatabases = GCSApi.ActivePlayerUnitDatabases();
var enemyDatabases = GCSApi.ActiveEnemyUnitDatabases();
var statusDatabases = GCSApi.ActiveStatusDatabases();
var encounterDatabases = GCSApi.ActiveEncounterDatabases();

var cards = GCSApi.Cards();
var decks = GCSApi.Decks();
var players = GCSApi.PlayerUnits();
var enemies = GCSApi.EnemyUnits();
var statuses = GCSApi.Statuses();
var encounters = GCSApi.Encounters();

GUID lookup uses the same Active databases for all six content types:

var card = GCSApi.FindCard(cardGuid);
var deck = GCSApi.FindDeck(deckGuid);
var player = GCSApi.FindPlayerUnit(playerGuid);
var enemy = GCSApi.FindEnemyUnit(enemyGuid);
var status = GCSApi.FindStatus(statusGuid);
var encounter = GCSApi.FindEncounter(encounterGuid);
tip
  • When a Manager exists, all six Active*Databases() methods and all six content collection methods create a new list on every call. Cache results for frequent reads instead of calling them repeatedly in Update or on every UI refresh.
  • When the scene has no valid Manager, list methods return empty collections and Find* returns null.

See the GCSApi Guide and API Reference for battle control, content discovery, and complete method signatures.

Trace missing content through the dependency chain

Database problems are often mistaken for card, FlowGraph, or battle-startup problems. Start by determining whether the current feature depends on Active enumeration or a Unity direct reference, then follow the corresponding path.

SymptomCheck firstContinue with
The target database is missing from the Database dropdown in Game Card EditorConfirm that the current scene contains GameCardManager and that the target database is registered and ActiveConfirm that the database type matches the current Editor mode
The Database dropdown contains the database, but the content list is emptyConfirm that the target database is selected and check Total in its InspectorCheck whether the new content was written to another Active database
An entity selector still shows Inactive contentCheck whether all Active databases contain zero entries of that entity type, triggering project-wide fallbackReturn to the Manager and inspect the actual Active set instead of inferring state from selector results
GCSApi.Cards() or another content method returns an empty collectionConfirm that the Manager is valid and that at least one database of the corresponding type is ActiveCheck whether the Active database actually contains content
GCSApi.Find* returns nullConfirm that the target content belongs to an Active database and verify the supplied GUIDCheck for duplicate GUIDs and confirm the first matching entry in Manager registration order
Change Status, Transform Card, Spawn Unit, or Add Cards with an inline Cards selector has no effectConfirm that the target content belongs to the first Active database of the corresponding typeConfirm that FlowGraph actually reaches the node, then inspect its inputs and targets
A card in a deck can still be drawn after its card database becomes InactiveThis happens because Starting Deck and Deck Entry preserve valid direct referencesIf code must still enumerate or find the card by GUID, enable its database again
The Bootstrap Inspector reports that the default Encounter is not in an Active databaseRegister and enable the database that stores the Encounter to restore the Ready stateThe warning does not prevent Bootstrap from starting the battle through the direct reference. Continue by checking the Encounter's player, enemies, rules, and reward-deck references

To verify the complete content chain for an encounter, start with GameEncounter, then check the player, Starting Deck, cards, enemies, reward deck, and statuses used by FlowGraph. For deeper diagnosis, see Common Symptoms, Authoring Errors, and Runtime Errors.