Publisher | André Filipe Silva |
---|---|
File size | 1.94MB |
Number of files | 57 |
Latest version | 1.3.0 |
Latest release date | 2023-09-29 05:51:49 |
First release date | 2023-08-10 05:18:27 |
Supported Unity versions | 2018.4.2 or higher |
Okto provides a pub-sub system for developers. It allows developers to publish messages into a topic and receive them in other scripts which have subscribed to the same topic. Okto operates without requiring the publisher to know about how many subscribers exist, and without having to have references to them. This results in cleaner and more modular code.
🗣️ Discord • 🌐 Website (soon) • 📖 Online Docs (soon) • 🆕 Changelog (soon)
Using Okto is straightforward. Developers can create a publisher for a given topic by registering with Okto. When a message is published on the topic, Okto will notify all registered subscribers of the message. Messages must inherit from the provided BaseMessage class.
Okto includes a debug window that developers can use to view all the currently registered publishers and subscribers. This is a useful tool for debugging code that uses Okto and ensures that messages are being sent and received as expected.
Okto gives developers the following advantages:
- 🧩 Modularity: Okto promotes a modular design approach, allowing scripts to be developed independently without worrying about how they will interact with each other.
- 🚀 Flexibility: Okto allows messages to be sent between scripts regardless of their location in the game hierarchy or scene, making it a flexible solution for projects with complex game structures.
- 🪲 Debugging: The debug window in Okto makes it easy to track all the current publishers and subscribers, and their connections, helping developers to quickly identify and fix issues.
Examples of possible use cases:
- 🥇 Achievements: When a player completes a part of an achievement, Okto can be used to notify an achievement manager script without requiring a reference to the script that triggered the event. When the achievement is completed, the manager can unregister the subscriber and no code related to that achievement will be executed again.
- 📈 Game Analytics: Okto can be used to consume data for a game analytics system when certain events occur in the game, such as a player completing a level or collecting an item. This eliminates the need for references to the analytics script in every relevant script.
- 🤖 AI Behavior: Okto can be used to trigger changes in AI behavior, such as having enemies react to a change in the player's health or armor, without requiring a direct reference between the scripts.