sschmid / Entitas

Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
MIT License
7.03k stars 1.11k forks source link

Make listeners be added through a single call, or automatically #1025

Open alexandrunechita-popcore opened 1 year ago

alexandrunechita-popcore commented 1 year ago

Is your feature request related to a problem? Please describe. Every time a listener is added to a View, user error might neglect to do _linkedEntity.AddMyListener(this) inside the View. Changing the Component's Event will also add/remove/modify the listener interfaces requiring the dev to updated the AddListener area.

Describe the solution you'd like Either:

A) _linkedEntity.AddListeners(this) and have it detect what listener interfaces belong to "this" and make the connections. B) Have it automatically happen without the dev ever think about it.

For backwards compatibility and user error, if the dev adds the listeners again or triggers _linkedEntity.AddListeners(this) manually, it should be ignored.