Skip to content

Loop over all components of all entities from view and call a function by name #1175

Answered by skypjack
Cyndeon asked this question in Q&A
Discussion options

You must be logged in to vote

I also feel like I should mention, no virtual voids are allowed for this since it is an engine and thus has to be performant.

There is a value(entity) function on the storage, you can combine it with type.from_void(...) to get a meta_any on which to invoke func.
However, I get it doesn't work for you due to a hypothetical performance problem that was never measured but only imagined? 🤔
In this case, the other alternative is to attach yet another function to the meta type to get the component from the registry.
My two cents: I'd use the cooked solution first, measure and only change it if you spot a bottleneck there.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by Cyndeon
Comment options

You must be logged in to vote
1 reply
@skypjack
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants