To view all catalogs in your project, find the DataMaster
entry in the Unity toolbar and select View Catalogs
. This will show the Catalog Browser window.
If you imported the DataMaster examples into your project, you will see those catalogs here.
In the Catalog Browser window, select the edit icon on the RPGItemDefinition
catalog. You will be presented with the items contained within the catalog.
If you look in your project view, you can see the catalog is stored at Plugins/DataMaster/Examples/01 - RPG Items/Catalogs/
. Note that RPGItemDefinition.cs
is what defines the catalog and the type of fields your data can use. Below is an excerpt of this file.
using DataMaster;
public class RPGItemDefinition : DataMasterCatalogItem
{
public enum ItemType
{
Weapon,
Armor,
Consumable
}
public ItemType Type;
public string Description;
// Only show attack damage if the type is a weapon.
[DMEnum("Type", ItemType.Weapon)]
public float AttackDamage;
...
}
Don’t worry about the file too much right now. Other sections of this documentation cover it in more detail, including the DMEnum attribute.
To see usage of the catalog within a running game, open up the Unity scene located at Plugins/DataMaster/Examples/01 - RPG Items/01 - RPG Items.unity
. Play the scene within the editor to cycle through the RPG Items in-game. To see how this works, look at the RPG Item Browser
GameObject in the scene. Specifically notice how the RPGItemDefinitionDatabase
asset was placed onto the object. This is the Catalog Database
asset managed by DataMaster.
In the RPG Items example, you can see a second catalog named TreasureChestReward
. This catalog shows an example of how to reference between catalogs. In this case, the TreasureChestReward
catalog has references to which RPGItems
a player may get from opening the chest.