Skip to content

Is having multiple for loops for iterating through the components in 'view' or a 'group', wrong thing to do? #681

Answered by skypjack
Doctor-Foxling asked this question in Q&A
Discussion options

You must be logged in to vote

Why can't I loop through a group twice to extract different components (if that is in fact an issue).

You can. There is nothing wrong in it. Though, without a reproducible example, it's impossible to tell you what's weong in what you're doing.

Why can't I have two separate groups that partially owns the same component and fully-owns the second component

It's the other way around. You cannot own the same component:

auto group = m_Registry.group<SpriteRendererComponent>(entt::get<TransformComponent>);
auto group2 = m_Registry.group<CubeRendererComponent>(entt::get<TransformComponent>);

Or even:

auto group = m_Registry.group<SpriteRendererComponent, TransformComponent>();
auto group2 = m…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@Doctor-Foxling
Comment options

Comment options

You must be logged in to vote
3 replies
@Doctor-Foxling
Comment options

@skypjack
Comment options

@Doctor-Foxling
Comment options

Answer selected by Doctor-Foxling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants