Comments (7)
Another possible oddity, for Matcher
s instead of OnEntityUpdate
it's OnEntityAddedOrRemoved
. If these methods represent the same functionality they should probably have the same method name.
from entitas.
I think you're right. In this case we can remove
gameBoardElements.OnEntityUpdated += onGameBoardElementUpdated
since replacing a component will also call OnEntityRemoved and OnEntityAdded. So it's redundant... I'll remove it from the example.
from entitas.
OnEntityAddedOrRemoved means it triggers when added OR when removed from the group.
To recap:
Adding a component to an entity might result in the entity being added to a group. This will trigger OnEntityAdded
Replacing the component will trigger OnEntityRemoved, OnEntityAdded, OnEntityUpdated
Removing the component will trigger OnEntityRemoved
Usually reactive systems are interested in changes in the group thus triggering OnEntityAdded. In my experience it's a rare case when you actually want to trigger OnEntityAddedOrRemoved, meaning reacting on any change in the group, e.g AccelerateSystem.cs
from entitas.
Makes sense. I appreciate the explanation.
from entitas.
I noticed OnEntityUpdated not function well when i change value in Unity inspector, when value changed, previousComponent is equals to newComponent.Same as OnEntityRemoved, when OnEntityRemoved's event is called, component's value(string type) has already be changed.I don't know if it is an issue.
from entitas.
I think you're right. The entity inspector just calls entity.ReplaceComponent() without using the componentPool and providing both the previous and the new component like the generated methods do.
I'll work on a fix.
Thanks for letting me know! :)
from entitas.
I destroyed my entity than entity's last component removed.
after long testing, I understand the mechanism (casting component Arg to removed component)
this is very confusing...
how about adding simple event?
like
Group.OnEntityRemoved(Entity entity);
have a good day.
from entitas.
Related Issues (20)
- Add/Replace/Remove vs Set/Unset HOT 5
- Boolean in setttings for unique components to actually be unique
- A component with multiple contexts +events, only make event listeners for 1 context
- Could not resolve type with token ... expected class System.Threading.CancellationToken HOT 10
- How to generate codes in a project which has several csproj files? HOT 1
- Update on Entitas 2.0-beta and my situation HOT 4
- [1.14.1]code gen twice and compile error HOT 1
- there is a Error, on click Tools/Jenny/Gennerate, how can I do? HOT 4
- _group.GetEntities().AsParallel().ForAll(Execute);这段语句有GC HOT 2
- Is it feasible to use Entitas in the backend? HOT 7
- Entity Behaviour in Unity inspector not visible HOT 2
- Removal of crucial SearchPaths when executing the wiz command
- How to get all group in some context, without reflection。
- GUI Null ref when trying to view entity in inspector HOT 1
- generator issues HOT 1
- Error running dotnet Jenny/Jenny.Generator.Cli.dll gen -v command - System.IO.FileNotFoundException HOT 1
- Bro i want remove this how i remove
- Generate error
- Visual debugging. Coloring components not working properly. HOT 2
- Fixed Point HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from entitas.