In the monobehaviour environment we have lots of tools (namely events) for decoupling different “sections” of our code. In ECS this is not as easy. This seems highly problematic. One of the main benefits of decoupling your code is maintainability. This is less of a concern when using ECS because you tend to write more maintainable code anyway, but it would still be a nice tool to have.
Something else to consider is assets… right now I’ve witten a stat system (a system which maintains a buffer of stats derived from arbitrary sources such as equipment, the talent system, and buffs / debuffs), a talent system which grants stats and does some other stuff, a “container” system which covers inventory, equipment, etc, and a few other systems. I’m not looking to turn these into assets but if I were I struggle to imagine how I would.
As it stands my talent and my container (think equipment) systems are aware of aspects of my stat system. When a piece of equipment is added or removed it must trigger a stat recalculation, and same when a talent is allocated or deallocated. In monobehaviour world I would fire an event. In ECS world I call something like
commandBuffer.AppendToBuffer(entity, new EquipStatItem { item = itemEntity });
which works fine but EquipStatItem is a stat-system type… Ideally the container-system should not be aware of it at all. If I wanted to sell my container system or my talent system I would have to give them the stat system too. Again, this isn’t bad (for me) but I am aspiring to create decoupled plugins that can be theoretically drag-and-dropped from one project to another and this seems basically impossible.
Am I doing something wrong? I’ve seen some events-in-ecs systems but without having a defacto Unity-backed option it feels weird to build a bunch of stuff on top of them.