Function ecs_get_target_for_id

Synopsis

#include <include/flecs.h>

FLECS_API ecs_entity_t ecs_get_target_for_id(const ecs_world_t *world, ecs_entity_t entity, ecs_entity_t rel, ecs_id_t id)

Description

Get the target of a relationship for a given id. This operation returns the first entity that has the provided id by following the specified relationship. If the entity itself has the id then entity will be returned. If the id cannot be found on the entity or by following the relationship, the operation will return 0.

This operation can be used to lookup, for example, which prefab is providing a component by specifying the IsA relationship:

// Is Position provided by the entity or one of its base entities? ecs_get_target_for_id(world, entity, EcsIsA, ecs_id(Position))

Parameters

world - The world.

entity - The entity.

rel - The relationship to follow.

id - The id to lookup.

Returns
The entity for which the target has been found.

Source

Line 2560 in include/flecs.h.