Dataset
Scripting with the Dataset class.
The Dataset
class is meant to be inherited from when creating a custom item dataset class.
Create Custom Dataset
Datasets let you set custom data through the Items section of the Inventool window when set up correctly. See the steps below to learn how to create a custom dataset.
Step 1: Inherit From Dataset
Create a new class and inherit from the Dataset
class.
using Esper.Inventool.Items;
using UnityEngine;
public class ItemDataset : Dataset
{
}
Step 2: Create Asset Menu Option
Dataset
is a ScriptableObject
class, which means it can be added to the asset menu.
using Esper.Inventool.Items;
using UnityEngine;
[CreateAssetMenu(fileName = "My Item Dataset", menuName = "Inventool/Datasets/My Item Dataset")]
public class ItemDataset : Dataset
{
}
Step 3: Add Custom Fields
Add your custom fields. If they are serializable, they will be available for each item in the Items section.
using Esper.Inventool.Items;
using UnityEngine;
[CreateAssetMenu(fileName = "My Item Dataset", menuName = "Inventool/Datasets/My Item Dataset")]
public class ItemDataset : Dataset
{
// These fields will appear for each item as long as an instance of this dataset is set in settings
public int myCustomInt;
public bool myCustomBool;
}
Step 4: Set For All Items
All you have left to do now is to create a new instance of your custom dataset from the asset menu and set it as the dataset reference for items from Settings.
Last updated