Popup

1 min read

Updated on November 21, 2025

Introduction

Displays ItemAmount information and animates the Popup upwards and fades it out. This information is given from a PopupSpawner or FPSPopupSpawner.

Setting up

There is a prefab Popup located in /prefabs/UI.

Setting up without the prefab is easy and only requires an Image and TextMeshProUGUI component. The other settings are given by a PopupSpawner.

Popups parent directly under a transform created at runtime by the Resource And Production Manager for tidyness and for when the originating object gets destroyed, the popup does not go with it and has its own lifetime.

This component should be assigned to the PopupSpawner or FPSPopupSpawner.

Settings

Icon
Assign an Image component to display the ItemAmount’s Item Icon.

Text
Assign a TextMeshProUGUI component to display the ItemAmount.Amount.

Scripting

/// <summary>
/// Create a popup with the Icon from ItemAmount.Item.Icon and the amount from ItemAmount.Amount
/// </summary>
/// <param name="itemAmount">The ItemAmount to take the information from</param>
/// <param name="added">Whether ItemAmount Amount is being added or removed</param>
public void InitPopup(ItemAmount itemAmount, bool added)

/// <summary>
/// Manually animate the popup move upwards
/// </summary>
/// <param name="riseVector">The Vector3 direction to move the popup</param>
/// <param name="duration">How long it should take to move it</param>
/// <param name="curve">The desired movement and fade curve</param>
public void AnimatePopup(Vector3 riseVector, float duration, AnimationCurve curve)