Entitas Flux is a fork of the great and terrible Entitas Framework.
I created it to add features missing from the original Entitas that I believe should be there, and to support newer Unity versions.
Don’t expect major changes or a big redesign like Entitas Redux. Updates will (or will not) come slowly and only when I need a feature.
Components that have a single field are generated with a single property, which simplifies access to the value:
[Game] public class CurrentHealth : IComponent { public float Value; }
// access:
entity.CurrentHealth
// instead of:
entity.currentHealth.ValueThis attribute simplifies deferred reactivity.
When component X is marked with the [Watched] attribute and its value is changed (via ReplaceX(...)/AddX(...)/RemoveX(), the entity receives an XChanged marker component.
These markers live for one frame: they notify systems during that frame and are then removed so the logic doesn’t repeat on the next frame.
[Game, Watched] public class Wallet : IComponent { public Dictionary<CurrencyTypeId, int> Value; }
// entity.ReplaceWallet(newValue);
// will cause entity.isWalletChanged to be `true`It will also generate a GameWatchedCleanupSystems feature that removes all those Changed component on cleanup. You should put it in your systems order, usually it fits well right before GameCleanupSystems.
In the original Entitas adding components via inspector is a pain because there’s no search bar. Entitas Flux has one.
Sometimes you just remove component X if it exists on the entity.
Without extra ifs or matcher checks, call SafeRemoveX():
entity.SafeRemoveBoxCollider2D();
entity.SafeRemoveCollider2D();Under the hood it does this:
if (hasBoxCollider2D)
RemoveComponent(GameComponentsLookup.BoxCollider2D);ENTITAS_DISABLE_REACTIVITY - partially disables Entitas' default reactivity. Gives small performance boost.
ENTITAS_HIDE_STANDARD_MEMBERS - hides standard generated component members that start with a lowercase letter in atomic components.
Just create new repo using THIS as a template.
If you already have Entitas project and you want to switch to this fork, then:
- Go to Releases and download the Entitas-Flux-vX.X.X archive. This archive contains framework DLLs.
- Replace the corresponding DLLs in the
EntitasandJennyfolders. The DLLs in the archive are organized by folder, so it’s easier to see which DLL goes where.
But just in case, here’s where everything should go:
// Jenny/Jenny/Plugins/Entitas:
Entitas.CodeGeneration.Plugins.dll
Entitas.Roslyn.CodeGeneration.Plugins.dll
Entitas.VisualDebugging.CodeGeneration.Plugins.dll
// Assets/Entitas/Entitas:
Entitas.CodeGeneration.Attributes.dll
Entitas.dll
Entitas.Unity.dll
Entitas.VisualDebugging.Unity.dll
// Assets/Entitas/Entitas/Editor:
Entitas.Migration.dll
Entitas.Migration.Unity.Editor.dll
Entitas.Unity.Editor.dll
Entitas.VisualDebugging.Unity.Editor.dll - Update your JennyRoslyn.properties with DataProviders and Generators Entitas Flux provides (JennyRoslyn.properties example)
- Hope it works :)
This project is licensed under the MIT License - see the LICENSE file for details.
