Dataset

📊 Dataset Class

A dataset that can be given to items. This is meant to be a parent class of your own dataset object.

Namespace: Esper.Inventool.Items Access: public Type: class Inherits: InventoolObject


📦 Fields

Access
Field
Type
Description

public static

resourcesPath

string

The path to all generated objects of this type relative to the resources folder.

public

item

Item

The item reference. (Hidden in inspector)


🔍 Properties

Access
Property
Type
Description

public static

DirectoryPath

string

The directory of all generated objects of this type. (Editor only)


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 MyItemDataset : 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 MyItemDataset : 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 MyItemDataset : 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.

Accessing Dataset At Runtime

You can access the dataset from an Item. Note that the field is stored as the default Dataset type, so you may need to convert it to your dataset type.

var myItemDataset = myItem.dataset as MyItemDataset;

Last updated