UniFlux | Call methods with zero references in Unity

For anyone prototyping or working with longest projects I’ve made a Free Open Source Library to send messages between classes GitHub - xavierarpa/UniFlux: Handle Events and States in Unity, Really Easy to Use and High Performant, We are now in Asset Store ! https://assetstore.unity.com/packages/slug/250332

1 Like

Uh… hmm… Looks very professional and the performance seems to be a major point.
Too bad I do not understand anything…

Please at very least describe what the examples are actually doing instead of throwing entirely undocumented code at the readme-reader.
Judging by the performance samples I assume it’s a Dependency Injection framework.

If you seek to reach a significant number of users I’d recommend not to assume that people already know dependency injection very well because those people likely already are tied to other frameworks for that and thus less likely to chose yours :wink:

Also note there was very recently a big discussion over here on the topic whether DI frameworks are actually needed in Unity projects or not (with a tendency towards not): Dependency Injection in Unity [Inversion of Control Container]
As a developer of such a system perhaps you can point out what the benefits (especially of your solution) are!

It’s an implementation of the Flux pattern for Unity. This can be an alternative to “singletons everywhere” and the “poor man’s DI container” most people use in Unity projects. IIRC, Flux was made popular by Facebook in the react days.

That said, might be a hard pill to swallow. Flux adds a lot of complexity to a project and isn’t really straightforward unless you fully understand the pattern and what is it intended to solve. Managing state in a game design context is much more straightforward than a large web app. We use Fluxor in my day job and sometimes it makes me want to shoot myself in the head.

I’d be interested in the performance of a Flux framework for Unity vs using source generated DI containers.

1 Like

Hello, it is true that at the beginning it is another way of thinking and therefore, its understanding can be complex at the beginning. But it can be very comfortable to communicate things in a decoupled way.

  • In my case I usually apply it under modules that allows me to separate blocks to have a better control of each part of the game and also allows me to test each module without depending on the whole game to be loaded.

Hello DragonCoder, thank you for your answer !
It’s true that I should improve the documentation, I would like to look for it to be as explainable as possible so that the knowledge barrier is not so strong to cross

a bit like @spryx has said , it can be seen as a singletons alternative but it’s not really the approach that should be seen.
you can interpret UniFlux in many ways because of its flexibility, one of my favorites is to have a modular vision and separate the project in modules and make independent each concept or part of your game, even allowing you to reuse content for other games or supplant a module with another one that keeps the same keys (which in this case would be the communication interfaces).

One of the key points is to avoid the excess of references or “Prop Drilling” that makes that sometimes the OOP can have excessive performance problems, with UniFlux, depending on the case you can simply make a call and the methods that are stored in the Store will be called and will act accordingly.

Update

You can Download here in Asset Store UniFlux - Handle Events & States for Unity - Open Source | Game Toolkits | Unity Asset Store

Heres the github GitHub - xavierarpa/UniFlux: Handle Events and States in Unity, Really Easy to Use and High Performant, We are now in Asset Store ! https://assetstore.unity.com/packages/slug/250332

And Heres the documentation Introduction | UniFlux