7ark / BetterEvents-Deprecated

A replacement for UnityEvents that are: better
MIT License
135 stars 13 forks source link

[FEATURE REQUEST] Adding Generic Constraints #3

Open RealCosmik opened 5 years ago

RealCosmik commented 5 years ago

hi, Thank you for this tool by the way its fantastic. I was wondering if you could the type safety features that most other iterations and improvements of unity events. I find it very useful to have betterEvent betterevent<T1,T2> etc. when designing my games with event systems to ensure the correct response is wired to the correct event given the generic constraints

amartinez1660 commented 3 years ago

I would like to comment on this a bit (although it's been there since 2019). This would also allow for 'Dynamic' type calling which I don't know if it is exactly possible as is... I lately when prototyping try to get an 'aggregator' class which detects changes on data all over the place and dispatches events for wiring to: Text.text, Image.Color, Score, etc... it's often UI related things though, granted and mostly only for very dynamic things. This is glued together via an UnityEvent?.Invoke(labelText); for example. Don't think this isn't possible just yet with BetterEvents.