Megafunk / MassSample

My understanding of Unreal Engine 5's experimental ECS plugin with a small sample project.
MIT License
681 stars 112 forks source link

Accessing the entities from outside/modifying the fragment values #28

Open RFornalik opened 2 years ago

RFornalik commented 2 years ago

The documentation/sample project would get much more beneficial if there was a section for accessing entities/their fragments from outside the system. For example: Setting destination point for certain entities that move torwards points.

Megafunk commented 2 years ago

If by "outside the system" do you mean not the entity being processed on? So far, It looks like entity fragment data can be accessed in two different way outside the processing execution context:


It's also probably slightly faster to do the whole `FMassEntityView` thing if you need to change more than a single fragment on the entity as it caches the archetype data, saving some extra work. (I think)

I'll document this stuff soon! I'm still learning stuff on the go as I use the API more.

![](https://c.tenor.com/T2xOiOP9dYEAAAAd/wallace-and-gromit-train-tracks.gif)
vorixo commented 2 years ago

Next consideration: How to get a FMassEntityHandle or a FMassEntityView from actor code.