Function ecs_get_target


#include <include/flecs.h>

FLECS_API ecs_entity_t ecs_get_target(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t rel, int32_t index)


Get the target of a relationship. This will return a target (second element of a pair) of the entity for the specified relationship. The index allows for iterating through the targets, if a single entity has multiple targets for the same relationship.

If the index is larger than the total number of instances the entity has for the relationship, the operation will return 0.


world - The world.

entity - The entity.

rel - The relationship between the entity and the target.

index - The index of the relationship instance.

The target for the relationship at the specified index.

Mentioned in


Line 2535 in include/flecs.h.