Craft

Scripting with the Craft class.

The Craft class functions as a blueprint for crafts.. This is essentially a crafting recipe.

Fields & Properties

Name
Description
Type
Access

id

The unique ID.

int

public

searchableName

The name of this craft for the purposes of searching inside Inventool's editor window.

string

public

combineItems

The items required to craft the result item.

List<ItemStack>

public

resultItem

The item that is created when the required items are combined.

ItemStack

public

cost

The amount this craft will cost.

Currency

public

DatabaseRecord

The database record of this craft.

CraftRecord

public

CraftingCode

A generated code created with crafting item combinations for craft lookups.

string

public

Creating Crafts

It's not at all recommended to create crafts at runtime, but it is possible. Craft's are scriptable objects which cannot be created as assets at runtime for later use.

Craft myCraft = ScriptableObject.CreateInstance<Craft>();

Getting Crafts

Crafts created through the Crafting tab can be retrieved at runtime.

Get a Single Craft

You can get a Craft by its ID, name, or code with the Inventool.GetCraft method.

Craft myCraft = Inventool.GetCraft("My Craft Name");

Get All Crafts

var myCrafts = Inventool.GetAllCrafts();

Requirements Checking

You can check if a list of items matches the requirement of the Craft to craft the result item.

bool result = myCraft.CanCraft(myListOfItemStacks);

Last updated