GodotNotificationCenter

GodotNotificationCenter is a simple notification center for the Godot Engine, allowing objects to observe and receive notifications from anywhere in the code. It supports Godot 3 and provides a straightforward way to implement a publish-subscribe pattern within your Godot projects.

https://github.com/didier-v/GodotNotificationCenter

Godot Notification Center

GodotNotificationCenter is a lightweight and easy-to-use notification center plugin for the Godot Engine. It simplifies the process of sending and receiving notifications between different objects in your game, enabling a more decoupled and maintainable architecture.

Key Features

  • Observer Pattern: Implements the observer pattern, allowing objects to subscribe to specific notifications and receive updates when those notifications are posted.
  • Easy Integration: Simple installation by adding notification_center.gd to your project's autoload settings.
  • Flexible Data: Notifications can carry data of any type, allowing you to send complex information between objects.
  • Memory Management: Provides methods for adding and removing observers, ensuring proper memory management and preventing memory leaks.
  • Godot 3 Support: Specifically designed and tested for compatibility with Godot 3.x.

Usage

To use the GodotNotificationCenter, simply add the notification_center.gd script to your autoload settings. You can then access the notification center from anywhere in your code using get_node("/root/nc") or $/root/nc (Godot 3 syntax). Observers can be added using nc.add_observer(observer, notificationName, action) and removed using nc.remove_observer(observer, notificationName). Notifications are sent using nc.post_notification(notificationName, notificationData). Remember to remove observers when they leave the scene to avoid potential errors.

Resource Details

library

didier-v



3