I open-sourced the modular Unity ecosystem I’ve been building over years of gamedev. I hope it saves you months of work just like it does for me
by u/Born_Development1284 in Unity3D
private IPlayerHealthService playerHealthService;
[SerializeField] private Text _label;
private void Awake()
{
playerHealthService = ServiceLocator.Get<IPlayerHealthService>();
playerHealthService.HPChanged += PlayerHealthService_HPChanged;
}
private void OnDestroy()
{
playerHealthService.HPChanged -= PlayerHealthService_HPChanged;
}
private void PlayerHealthService_HPChanged(int currentHP)
{
Refresh(currentHP);
}
private void Refresh(int currentHP)
{
_label.text = $"Player HP: {currentHP}";
}
public readonly struct CoinCollectedEvent : IEvent
{
public readonly int Amount;
public CoinCollectedEvent(int amount)
{
Amount = amount;
}
}
public class Coin : MonoBehaviour
{
private IEventService _eventService;
[SerializeField] private int _coinValue = 1;
private void Awake()
{
_eventService = ServiceLocator.Get<IEventService>();
}
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player"))
{
_eventService.Raise(new CoinCollectedEvent(_coinValue));
Destroy(gameObject); // this should be replaced with an object pooling system
}
}
}
Shaders, tools, animation, math, and more, the new "Unity Dev Bundle" is still available for a bit longer. 🔥 Get it here: https://t.co/gPPcuZDuFX#unity3d #gamedev pic.twitter.com/mnxRUCtUHC
— Jettelly Inc. (@jettelly) April 8, 2026