Collectable Item Icon
Introduction
A widget used to display the collection state of an item by showing/hiding an image
Dependencies
The CollectableItemIcon
relies on other components of this plugin to work:
- Logger: Used to log useful information to help you debug any issues you might experience
Required Widgets
You need to add the following before you can compile the CollectableItemIcon
widget:
Name | Description | Type |
---|---|---|
Icon | The Icon displayed if the item is collected | UImage* |
API Reference
Properties
Property | Description | Type | Default Value |
---|---|---|---|
RequiredValue | The required value before the item is considered collected | float |
Functions
Name | Description | Params | Return |
---|---|---|---|
UpdateState | Update the collected state (and visibility) of the icon | IsCollected (bool) Is the item collected? |
|
UpdateValue | Update the value of the item and adjust the collected state if necessary | Value (float) The current value of the item |
|
MonitorTrackableValue | Monitor the trackable data and automatically update the icon state whenever the value changes | TrackableDataComponent (UTrackableDataComponent*) A reference to the TrackableDataComponent DataName (FName) The name of the data item to monitor |
Blueprint Usage
You can use the CollectableItemIcon
using Blueprints by adding one of the following nodes:
- Ultimate Starter Kit > UI > Update State
- Ultimate Starter Kit > UI > Update Value
- Ultimate Starter Kit > UI > Monitor Trackable Value
C++ Usage
Before you can use the plugin, you first need to enable the plugin in your Build.cs
file:
PublicDependencyModuleNames.Add("USK");
The CollectableItemIcon
can now be used in any of your C++ files:
#include "USK/Widgets/CollectableItemIcon.h"
void ATestActor::Test()
{
// CollectableItemIcon is a pointer to the UCollectableItemIcon
CollectableItemIcon->UpdateState(IsCollected);
CollectableItemIcon->UpdateValue(Value);
CollectableItemIcon->MonitorTrackableValue(TrackableDataComponent, DataName);
}