Menu
CoddyTech

Recap: Achievement Popup

Part of the Game Architecture in Unity section of Coddy's Unity journey. Lesson 16 of 64.

challenge icon

Challenge

Easy

Give the coin game achievements. AchievementPopup.Show is ready, and the scene wires onUnlocked to it.

  1. Collector: on touching a Coin-tagged object, destroy it and raise public event Action<int> OnCoinsChanged with the total.
  2. Achievements: subscribe to collector in OnEnable, unsubscribe in OnDisable.
  3. At 1, 3 and 6 coins, invoke public UnityEvent<string> onUnlocked with First Coin, Pocket Money, Coin Hoarder.

Press Play and collect the coins. Then Check.

Try it yourself

using UnityEngine;
using UnityEngine.Events;

public class Achievements : MonoBehaviour
{
    public Collector collector;
}

All lessons in Game Architecture in Unity

Practice on your own: Unity playground