ItemAttributeTemplate - jimdroberts/FishMMO GitHub Wiki
ScriptableObject template for item attributes, defining min/max values and associated character attribute. Used to configure item attribute ranges and their effect on character stats.
-
public int MinValue
The minimum value for this item attribute.
-
public int MaxValue
The maximum value for this item attribute.
-
public CharacterAttributeTemplate CharacterAttribute
The character attribute this item attribute affects or is associated with.
-
public string Name { get; }
Gets the name of this item attribute template (defaults to the asset name).
- Create a new ItemAttributeTemplate asset via the Unity Editor (Assets > Create > FishMMO > Item > Item Attribute > Attribute).
- Set the MinValue and MaxValue fields to define the attribute's value range.
- Assign the CharacterAttribute field to link this attribute to a character stat.
- Reference the ItemAttributeTemplate in item templates or scripts as needed.
// Example 1: Accessing attribute values from a template
ItemAttributeTemplate attrTemplate = ...; // Reference to the template
int min = attrTemplate.MinValue;
int max = attrTemplate.MaxValue;
CharacterAttributeTemplate charAttr = attrTemplate.CharacterAttribute;
// Example 2: Using the Name property
string attrName = attrTemplate.Name;
- Use descriptive names for each ItemAttributeTemplate asset for clarity.
- Set appropriate min/max values to ensure balanced gameplay.
- Link each item attribute to the correct CharacterAttributeTemplate for intended effects.
- Document the purpose of each attribute in the asset's Inspector description.