#2167·flecs

Creating entity observer for an entity with no components

Author: MohammadMDSACreated Jun 27, 2026Updated Jun 28, 2026

Hello, Please help me, I am really struggling with this: I need to create an entity observer that depends on no components on entity and I need it to run for a specific entity. I am doing it like this but my callback doesn't get triggered.

flecs::entity ent;
flecs::observer observer = world.observer()
    .event<Foo>()
    .with(flecs::Wildcard)
    .entity(ent)
    .each([](flecs::iter& InIter, size_t InIndex)
    {
        ...
    });

Please tell me what I am doing wrong. Thanks!