Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event Aggregator proposal #424

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zaradai
Copy link

@zaradai zaradai commented May 5, 2021

A limited change to demonstrate events published from Input.

An EventAggregator was created and a SO to hold the instance so that it can be shared within the project.

The publishers were located in Inputs and for limited changes only those events that were applicable to Protagonist was applied.

Also there is a UnityEventBus that was created to avoid reflection and link to UnityActions that could be exposed to the inspector or an existing function can be used. The later was demonstrated in the camera manager.

A limited change to demonstrate events published from Input.

EventAggregator was applied to Protagonist.
UnityEventBus was applied to camera events.
@CLAassistant
Copy link

CLAassistant commented May 5, 2021

CLA assistant check
All committers have signed the CLA.

@ciro-unity ciro-unity added the enhancement New feature or request label May 5, 2021
@ciro-unity ciro-unity self-assigned this May 5, 2021
public class Protagonist : MonoBehaviour
public class Protagonist : MonoBehaviour,
IHandle<AttackEvent>,
IHandle<JumpEvent>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming here is gorgeous!

@TH3UNKN0WN-1337
Copy link

Assets\ScriptableObjects\Input\InputReader.asset is missing the assignment of EventAgregator and EventBus.
I like the approach you take here. We use something similar, inspired by Caliburn.Micro as well. Good job! :)

@ciro-unity
Copy link
Contributor

Cool ideas. I've written some feedback on the forums!
https://forum.unity.com/threads/event-system-refactoring.1113253/#post-7162234

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants