Function ecs_get_target

Synopsis

#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)

Description

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.

Parameters

world - The world.

entity - The entity.

rel - The relationship between the entity and the target.

index - The index of the relationship instance.

Returns
The target for the relationship at the specified index.

Mentioned in

Source

Line 2535 in include/flecs.h.