Function ecs_field_w_size


#include <include/flecs.h>

FLECS_API void * ecs_field_w_size(const ecs_iter_t *it, size_t size, int32_t index)


Obtain data for a query field. This operation retrieves a pointer to an array of data that belongs to the term in the query. The index refers to the location of the term in the query, and starts counting from one.

For example, the query "Position, Velocity" will return the Position array for index 1, and the Velocity array for index 2.

When the specified field is not owned by the entity this function returns a pointer instead of an array. This happens when the source of a field is not the entity being iterated, such as a shared component (from a prefab), a component from a parent, or another entity. The ecs_field_is_self operation can be used to test dynamically if a field is owned.

The provided size must be either 0 or must match the size of the datatype of the returned array. If the size does not match, the operation may assert. The size can be dynamically obtained with ecs_field_size.


it - The iterator.

size - The type size of the requested data.

index - The index of the field in the iterator.

A pointer to the data of the field.


Line 3954 in include/flecs.h.