No more chainable APIs?
See original GitHub issueI am in the process of upgrading my project to a newer version of Entitas and I noticed that 0.37.0 is generating void for the component methods, which means I can no longer chain Entity creation, ie, something like below no longer works;
context.ReplaceMoveInput(movement).IsDeleteOnExit(true);
Or for a specific entity,
e.AddTurnBased(i + 1, config.turnDelay)
.IsAIMove(true)
.AddFoodDamager(dmg)
.AddSmoothMove(config.turnDelay)
.AddAudioAttackSource(Audio.scavengers_enemy1, Audio.scavengers_enemy2);
Is there a replacement or new best practice for this functionality? Having a fluent style API was really nice for quickly setting up entities.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Fluent APIs Using Method Chaining in JavaScript
Methods that stop the chain. They can return any final value. You cannot chain more methods to this value. An example. Let's code...
Read more >When to Build Fluent APIs
Fluent API - No Longer Set. Fluent programming interfaces use method chaining and domain-specific language to mimic declarative programming ...
Read more >LeaVerou/chainvas: Make APIs suck less
A tiny, modular library that can add chaining to any API that isn't naturally chainable, like the Canvas API, the DOM and more....
Read more >Fluent APIs And Method Chaining - Modern Web
Rather, Method Chaining should be used, perhaps more appropriately, as a means of implementing Fluent APIs which allow for writing more concise expressions....
Read more >Solved: API chaining
If I have a scenario where one api proxy needs to call another API, what is the best way to do it? I...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hey @JamesMcMahon,
sorry for removing this, but the good thing is, if you’re preferring a different output from the code generator you can easily customize this by adding and using a custom generator.
All current generators can be found here: https://github.com/sschmid/Entitas-CSharp/tree/develop/Addons/Entitas.CodeGeneration.Plugins/Entitas.CodeGeneration.Plugins/Plugins/CodeGenerators
You can create a new class and get inspired (aka copy paste) by existing generators. Put all your custom generators into an Editor folder and you will be able to select them in the Entitas Prefs Window.
You could for example change the
ComponentEntityGeneratorand create a custom one that return the entity.https://github.com/sschmid/Entitas-CSharp/blob/develop/Addons/Entitas.CodeGeneration.Plugins/Entitas.CodeGeneration.Plugins/Plugins/CodeGenerators/ComponentEntityGenerator.cs#L20-L43
Hope that helps
It’s due to performance. See: https://gitter.im/sschmid/Entitas-CSharp?at=58a356d321d548df2c0c0367