Mass¶
19 tools for Mass entities: entity configs and traits, spawners, tags, signals and archetypes.
Back to the index.
add_mass_tag_to_entity¶
Additive
Add an FMassTag (a tag, not a trait or fragment, despite the name) to a Mass entity of the editor world (not PIE) by archetype migration. Caveat: EVERY entity sharing that archetype gets the tag, not only this one. Returns old_archetype_id, new_archetype_id and changed; inverse: remove_mass_tag_from_entity.
| Parameter | Type | Required | Description |
|---|---|---|---|
entity_handle |
string | yes | Entity handle as "Index:SerialNumber", two integers such as "12:3" (no braces); a no-longer-valid entity is an error |
tag |
string | yes | Reflected name of an FMassTag struct without the F prefix, as list_mass_tag_types returns it (e.g. "MassOffLODTag"); /Script paths do not resolve |
Returns: { entity_handle, old_archetype_id, new_archetype_id, tag, changed }
add_mass_trait¶
Additive Idempotent
Adds a trait (a concrete UMassEntityTraitBase subclass) to a UMassEntityConfigAsset and saves the config. Idempotent: if the config already holds a trait of exactly that class, itself or through its parent config chain, nothing is added or saved and the reply has added=false, already_existed=true and that trait's trait_path. trait_class takes a reflected name with or without its U prefix, or a /Script path; an unknown or non-trait class is an error, but an abstract one is not refused: the engine creates it behind an ensure and warns it is nulled out on save. Edit it with set_properties on its object_path from list_mass_traits; remove_mass_trait is the inverse; add_mass_tag_to_entity tags a live entity instead.
| Parameter | Type | Required | Description |
|---|---|---|---|
config_path |
string | yes | Asset path to the UMassEntityConfig |
trait_class |
string | yes | Trait class name to add (e.g. UMassMovementTrait) |
Returns: { config_path, trait_class, trait_path, trait_count, added, already_existed, saved }
create_mass_entity_config¶
Additive
Create a UMassEntityConfigAsset (an empty list of Mass traits) at package_path/config_name and save it; an existing config there is loaded and re-saved instead (created:false). Returns config_path, trait_count and saved. Add traits with add_mass_trait, then link it with set_mass_spawner_entity_types.
| Parameter | Type | Required | Description |
|---|---|---|---|
config_name |
string | yes | Name of the UMassEntityConfig asset |
package_path |
string | no | Target content package path where the asset is created (default /Game/MCP) |
Returns: { config_path, config_name, trait_count, created, saved }
delete_mass_entity¶
Destructive
Destroy a single Mass entity by its handle (Index:SerialNumber), or with all=true every Mass entity in the editor world (not a PIE world), archetype by archetype; no undo either way. Give exactly one of entity_handle and all. To despawn what one spawner made use despawn_mass_entities.
| Parameter | Type | Required | Description |
|---|---|---|---|
entity_handle |
string | no | "{Index}:{SerialNumber}" string returned by spawn/query. Provide this OR all. |
all |
boolean | no | Optional bool, default false: true destroys every entity of the editor world's entity manager instead of one. Provide this OR entity_handle. |
Returns: { entity_handle?: string, destroyed?: bool, already_destroyed?: bool, all?: bool, destroyed_count?: int, before_count?: int, after_count?: int }
despawn_mass_entities¶
Destructive
Trigger entity despawning on a AMassSpawner (DoDespawning from the FTSTicker path, outside Mass processing); inverse of spawn_mass_entities. Reports the global Mass entity-count delta; no-op (was_empty) when this spawner spawned nothing.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_label |
string | yes | Editor label of the AMassSpawner actor |
Returns: { actor_label, entity_count_before, entity_count_after, despawned, was_empty, note }
fire_mass_signal¶
Destructive
Raise a named Mass signal through the UMassSignalSubsystem of the editor world (not a PIE world) for one entity, or for every live entity when entity_handle is left out; the signal processors subscribed to that name react the next time Mass processing runs in that world, which is the only side effect (nothing is saved and there is no undo step). Use it to trigger signal-driven logic (for example StateTree re-evaluation) without waiting for gameplay. The signal name is NOT validated: a name no processor listens to is accepted and does nothing, and dispatched_count still counts the entities signalled. An entity_handle that does not parse or names no live entity (check it with get_mass_entity_info) is an error and nothing is signalled; so is a world without the Mass signal or entity subsystem. Count the live entities with list_mass_archetypes or get_mass_entity_count.
| Parameter | Type | Required | Description |
|---|---|---|---|
signal |
string | yes | Signal name, as the receiving processors subscribe to it, e.g. "StateTreeActivate" (case-insensitive FName); any name is accepted. |
entity_handle |
string | no | Optional handle "Index:SerialNumber" of one live entity, e.g. "12:3" (Index above 0, SerialNumber not 0). Leave it out to signal every live entity of the editor world. |
Returns: { signal, dispatched_count: int, broadcast: bool }
get_mass_config_parent¶
Read-only
Read the parent config path of a UMassEntityConfigAsset (inverse of set_mass_config_parent).
| Parameter | Type | Required | Description |
|---|---|---|---|
config_path |
string | yes | Asset path of the UMassEntityConfigAsset |
Returns: { config_path, parent_config_path, has_parent, config_class }
get_mass_entity_count¶
Read-only
Count entities matching a fragment/tag requirement. Requires "fragment" (UScriptStruct path or name) and optional "presence" ("All"|"Any"|"None" — default "All"). For tag-only queries use "tag" (UScriptStruct path).
| Parameter | Type | Required | Description |
|---|---|---|---|
fragment |
string | no | Script struct path or name (e.g. "/Script/MassMovement.MassMovementFragment" or "FMassMovementFragment"). |
tag |
string | no | Optional. Same format as fragment. Use to require an FMassTag marker. |
presence |
string | no | "All" (default), "Any", or "None". |
Returns: { matching_count: int, fragment, tag, presence }
get_mass_entity_info¶
Read-only
Inspect one Mass entity of the editor world (not PIE) by handle, read-only: valid, built, archetype_id and the fragment types of its archetype. A destroyed or unknown handle returns valid:false rather than an error; a malformed handle is an error.
| Parameter | Type | Required | Description |
|---|---|---|---|
entity_handle |
string | yes | Entity handle as "Index:SerialNumber", two integers such as "12:3" (no braces) |
Returns: { entity_handle, valid, built, archetype_id, fragment_count, fragment_types: [string] }
get_mass_spawner_info¶
Read-only
Read an AMassSpawner actor of the editor world, found by actor label (first match), read-only. Returns actor_name, count (the spawn count set_mass_spawner_count writes) and entity_types [{entity_config, proportion}] (what set_mass_spawner_entity_types writes) with entity_type_count; the entities it spawned are counted by list_mass_archetypes instead.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_label |
string | yes | Editor label of the AMassSpawner actor |
Returns: { actor_label, actor_name, count, entity_type_count, entity_types: [{ entity_config, proportion }] }
list_mass_archetypes¶
Read-only
Census the Mass entities of the editor world (not a PIE world), read-only: every archetype with its live-entity and fragment counts. Returns archetype_count, total_entities (the sum over the archetypes), total (the entity manager's own count) and archetypes [{archetype_id, entity_count, fragment_count}], sorted by archetype_id and paged with offset/limit (archetype_count counts them all); get_mass_entity_info names the fragments of one entity, get_mass_entity_count counts by fragment or tag.
| Parameter | Type | Required | Description |
|---|---|---|---|
offset |
integer | no | Index of the first entry returned, counted from 0 (default 0). Read the next page at the reply's next_offset. |
limit |
integer | no | Most entries returned per call, 1..1000 (default 100). |
Returns: { archetype_count: int, total_entities: int, total: int (live entities), archetypes: [{ archetype_id: string, entity_count: int, fragment_count: int }], offset: int, limit: int, returned: int, truncated: bool, next_offset: int|null }
list_mass_tag_types¶
Read-only
Lists the Mass tag types loaded in this editor: every struct derived from FMassTag, the zero-size markers an entity carries or not (e.g. MassOffLODTag), each with its reflected name and path, sorted by path and paged with offset/limit. Abstract tag structs are left out unless include_abstract is true; nothing else is filtered. Read-only reflection: changes nothing. The name is what add_mass_tag_to_entity and remove_mass_tag_from_entity take as tag. Tags are not traits: the traits an entity config holds are listed with list_mass_traits and added with add_mass_trait; live entities and their archetypes come from list_mass_archetypes and get_mass_entity_info.
| Parameter | Type | Required | Description |
|---|---|---|---|
include_abstract |
boolean | no | Optional bool, default false; true also lists tag structs marked Abstract (bases that are not meant to be set on entities). |
offset |
integer | no | Index of the first entry returned, counted from 0 (default 0). Read the next page at the reply's next_offset. |
limit |
integer | no | Most entries returned per call, 1..1000 (default 100). |
Returns: { count (entries in this page), traits: [{ name, path }], total: int, offset: int, limit: int, returned: int, truncated: bool, next_offset: int|null } -- traits holds the tag types (name without the F prefix, e.g. "MassOffLODTag"; path is the /Script path)
list_mass_traits¶
Read-only
List the traits a UMassEntityConfigAsset holds itself (not those inherited from its parent config), read-only, in config order. Returns config_path, trait_count and traits [{class, name, object_path}]; add and remove them with add_mass_trait and remove_mass_trait, and read or write a trait's settings with get_properties and set_properties on its object_path.
| Parameter | Type | Required | Description |
|---|---|---|---|
config_path |
string | yes | Asset path to the UMassEntityConfig |
Returns: { class, name, config_path, trait_count, traits }
remove_mass_tag_from_entity¶
Destructive
Remove an FMassTag from a Mass entity of the editor world (not PIE) by archetype migration; inverse of add_mass_tag_to_entity. Caveat: the tag is removed from EVERY entity sharing that archetype, not only this one. Returns old_archetype_id, new_archetype_id and changed (false when nothing moved).
| Parameter | Type | Required | Description |
|---|---|---|---|
entity_handle |
string | yes | Entity handle as "Index:SerialNumber", two integers such as "12:3" (no braces); a no-longer-valid entity is an error |
tag |
string | yes | Reflected name of the FMassTag struct to remove, without the F prefix, as list_mass_tag_types returns it (e.g. "MassOffLODTag"); /Script paths do not resolve |
Returns: { entity_handle, old_archetype_id, new_archetype_id, tag, changed }
remove_mass_trait¶
Destructive
Remove one trait from the trait list of a Mass entity config asset (UMassEntityConfigAsset), picked by index or by class, then save the asset; there is no undo step. Inverse of add_mass_trait. It only reaches traits the config holds itself, as list_mass_traits shows them: a trait inherited from the parent config (set_mass_config_parent) stays. Not idempotent: once the trait is gone, a repeat call is an error (no matching class, or index out of range), and so are both or neither selector, a config that does not load and an unknown or non-trait class; nothing changes then. Later traits shift down one index. A failed save (for example while PIE runs) makes success false with the removal only in memory. To untag one live entity instead use remove_mass_tag_from_entity.
| Parameter | Type | Required | Description |
|---|---|---|---|
config_path |
string | yes | Asset path of the Mass entity config, e.g. "/Game/Mass/DA_CrowdAgent", as create_mass_entity_config returns it (config_path). |
trait_index |
number | no | 0-based position in the config's own trait list, as list_mass_traits reports it (traits[] order); give this or trait_class, not both. |
trait_class |
string | no | Trait class name, with or without its U prefix, or a /Script path, e.g. "MassMovementTrait"; removes the first own trait whose class is that class or a subclass of it. Give this or trait_index, not both. |
Returns: { config_path, removed, removed_trait_class, removed_index, trait_count, saved }
set_mass_config_parent¶
Destructive Idempotent
Set the parent config of a Mass entity config asset (UMassEntityConfigAsset), so the child inherits every trait of the parent chain on top of its own, replacing any parent it had, then save the child; there is no undo step. Use it to share a base trait set between configs instead of repeating add_mass_trait on each. Read it back with get_mass_config_parent; the child's own traits stay as list_mass_traits shows them. A repeat call with the same parent sets and saves again (set stays true). There is no way to clear the parent here. A config or parent that does not load, or a config given as its own parent, is an error and nothing changes; longer cycles (A under B under A) are not checked. A failed save (for example while PIE runs) makes success false with the change only in memory.
| Parameter | Type | Required | Description |
|---|---|---|---|
config_path |
string | yes | Asset path of the child config to change, e.g. "/Game/Mass/DA_Soldier", as create_mass_entity_config returns it (config_path). |
parent_config_path |
string | yes | Asset path of the config to inherit from, e.g. "/Game/Mass/DA_BaseAgent"; must be a different UMassEntityConfigAsset. |
Returns: { config_path, parent_config_path, parent, set, saved }
set_mass_spawner_count¶
Destructive Idempotent
Set how many entities an AMassSpawner actor in the editor world spawns (its protected Count property, written by reflection); spawn_mass_entities spawns this count, scaled by the spawner's SpawningCountScale and the scalability spawn density. No undo step, and the level is neither marked dirty nor saved (save_level). Use it before spawn_mass_entities; set the types with set_mass_spawner_entity_types; read the current count with get_mass_spawner_info. Idempotent: the same count again gives the same result. set is true when the count read back equals the requested one. A missing actor_label or count, or no spawner with that label, is an error and nothing changes; the count is not range-checked.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_label |
string | yes | Editor label of the AMassSpawner actor, e.g. "CrowdSpawner"; matched case-insensitively, first match in the editor world (not PIE). |
count |
number | yes | Number of entities to spawn, an integer such as 100 (a fraction is truncated). |
Returns: { actor_label, count, set }
set_mass_spawner_entity_types¶
Destructive Idempotent
Replace the entity types of an AMassSpawner actor in the editor world (its protected EntityTypes list, written by reflection) with the given Mass entity configs, each at proportion 1.0. It replaces, never appends: the old list is cleared first, and an empty array leaves the spawner with no types. Paths that do not load as a UMassEntityConfigAsset are skipped silently, so compare linked with the number you passed. No undo step, and the level is neither marked dirty nor saved (save_level). Place the spawner first with spawn_actor (type "MassSpawner"); set how many it spawns with set_mass_spawner_count; read back with get_mass_spawner_info; spawn with spawn_mass_entities. A missing actor_label or config_paths, or no spawner with that label, is an error and nothing changes. Idempotent: the same list gives the same result.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_label |
string | yes | Editor label of the AMassSpawner actor, e.g. "CrowdSpawner"; matched case-insensitively, first match in the editor world (not PIE). |
config_paths |
array | yes | Array of Mass entity config asset paths, e.g. ["/Game/Mass/DA_CrowdAgent"], as create_mass_entity_config returns them (config_path); [] clears the list. |
Returns: { actor_label, entity_type_count, linked, set }
spawn_mass_entities¶
Additive
Run DoSpawning on an editor-world AMassSpawner found by actor_label and report the global Mass entity-count delta -- it spawns entities, not an actor (spawn_actor places the spawner). All configured types spawn at the spawner's own count (set_mass_spawner_count); a count that differs from it is an error and nothing is spawned. spawned can be 0. Inverse: despawn_mass_entities.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_label |
string | yes | Editor label of the AMassSpawner actor |
count |
integer | no | Optional; must equal the spawner's own count (set_mass_spawner_count), which is what DoSpawning spawns. Any other value is an error and nothing is spawned. |
Returns: { actor_label, entity_count_before, entity_count_after, spawned, spawner_count, note }