ItemAttribute.cs

v4.0

ItemAttribute is a Scriptable Object which is intended to augment an ItemObject, providing more details about it, perhaps describing it. Beyond simply being a thing that changes an ItemObject, the ItemAttribute can also affect Stat objects, so that a "Fire Sword" can do something because of the "Fire" (an ItemAttribute) beyond simply having a cool name.

A GameItemAttribute, the runtime version of ItemAttribute, can also be added to any other object and used in various ways. It can affect the Stats of an IHaveStats object, even if it is not in a GameItemAttributeList, or attached to a GameItemObject.

ItemAttribute.cs
public string ObjectName
public string ObjectType

// ItemAttributes can change the FullName() of a GameItemObject they are attached to
public int nameOrder = 0;
public string humanName = "";

Setup

The objectType of an Item Attribute is the name of the folder the Scriptable Object is in. Create one named as you'd like, and right-click inside to select the menu option:

/Create/Game Modules/Items/Item Attribute

This will create an ItemAttribute Scriptable Object in your project. Select that and view the Inspector to begin setting up your data. The name of the Scriptable Object is saved as the objectName value.

Note that names of Item Attributes must be unique. The console will provide a warning if there are multiple Item Atrributes with the same name.

Inspector

Select your new object and view it in the Inspector. Here is where you can manage all the details about this Item Attribute. Note there are multiple tabs, each of which provide access to specific, and optional, information.

The Settings tab allows you to specify how the ItemAttribute effects other things, how it may change the name of GameItemObjects it's attached to, and which other ItemAttributes it either requires, or is incompatible with.

pageGeneral SettingspageName SettingspageRequisite Attributes

Last updated