forEachProperty Method

Call a function for each property of this Entity.

forEachProperty(func: PropertyCallback, includeCustom: booleantrue): void

@note Custom-handled properties are core properties that have behavior enforced by C++ handlers.

@example

// Deprecated method
entity.forEachProperty((name, propMetaData) => {
  console.log(`Property name: ${name}, Property type: ${propMetaData.primitiveType}`);
});

// New method
entity.forEach((name, property) => {
  console.log(`Property name: ${name}, Property type: ${property.propertyType}`);
});
Parameter Type Description
func PropertyCallback The callback to be invoked on each property
includeCustom boolean If true (default), include custom-handled properties in the iteration. Otherwise, skip custom-handled properties.

Returns - void

Defined in

Last Updated: 03 April, 2025