Class InventoryItemHudView
Component that manages displaying a Inventory Item's icon and quantity. When attached to a game object, it will display the Inventory Item's icon and quantity.
Inherited Members
Namespace: UnityEngine.GameFoundation.Components
Syntax
[AddComponentMenu("Game Foundation/Inventory Item HUD View", 5)]
[ExecuteInEditMode]
public class InventoryItemHudView : MonoBehaviour
Properties
iconImageField
The Image component to assign the InventoryItem icon image to.
Declaration
public Image iconImageField { get; }
Property Value
Type | Description |
---|---|
Image |
iconSpritePropertyKey
The Static Property key string that should be used for getting the sprite of the Inventory Item for displaying in the hud view.
Declaration
public string iconSpritePropertyKey { get; }
Property Value
Type | Description |
---|---|
String |
itemDefinition
A reference to the InventoryItemDefinition definition.
Declaration
public InventoryItemDefinition itemDefinition { get; }
Property Value
Type | Description |
---|---|
InventoryItemDefinition |
itemDefinitionKey
The identifier of the InventoryItem to display.
Declaration
public string itemDefinitionKey { get; }
Property Value
Type | Description |
---|---|
String |
quantityTextField
The TextMeshProUGUI component to assign the InventoryItem quantity to.
Declaration
public TextMeshProUGUI quantityTextField { get; }
Property Value
Type | Description |
---|---|
TMPro.TextMeshProUGUI |
Methods
SetIconImageField(Image)
Sets the Image component to display Inventory item icon sprite on this view.
Declaration
public void SetIconImageField(Image image)
Parameters
Type | Name | Description |
---|---|---|
Image | image | The Image component to display Inventory item icon sprite. |
SetIconSpritePropertyKey(String)
Sets the property key to use when getting the sprite of the Inventory Item icon.
Declaration
public void SetIconSpritePropertyKey(string propertyKey)
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | The Static Property key to look up sprite by. Inventory Item doesn't have this key in its Static Properties will not display an icon. |
SetItemDefinition(InventoryItemDefinition)
Sets Inventory Item should be displayed by this view.
Declaration
public void SetItemDefinition(InventoryItemDefinition itemDefinition)
Parameters
Type | Name | Description |
---|---|---|
InventoryItemDefinition | itemDefinition | The Inventory Item definition that should be displayed. |
SetQuantityTextField(TextMeshProUGUI)
Sets the TextMeshProUGUI component to display the Inventory item quantity on this view.
Declaration
public void SetQuantityTextField(TextMeshProUGUI text)
Parameters
Type | Name | Description |
---|---|---|
TMPro.TextMeshProUGUI | text | The TextMeshProUGUI component to display the Inventory item quantity |