set_component_property
Set any property on a level actor's component—structs, arrays, maps, refs, enums, tags—targeting the editor world or a live PIE world by name.
Instructions
Set the value of any property on a level actor's component via the canonical JSON->property importer (mcp_common::SetObjectProperty). Handles every FProperty kind: object/soft-object/class/soft-class refs (by "/Game/..." path string), enums (by name), FGameplayTag/FGameplayTagContainer (registry-validated), nested structs, arrays, sets and maps -- not just scalars, FVector, FRotator and FLinearColor. WARNING: it writes the EDITOR world BY DEFAULT even while PIE is running, and that is deliberate, not a bug: it is the only MCP route to a property Python's set_editor_property refuses (CPF_DisableEditOnInstance), and because the edit lands in the editor instance the NEXT PIE session already starts with it. The flip side is that a value written mid-PIE does NOT reach the running actor -- so to hit the live one you must ask for it: world='server' | 'client' | 'pie:N'. The reply stamps world_name/world_package/world_type/net_mode/pie_instance, so success:true says WHICH world was written (world_package is the field carrying the UEDPIE_N prefix -- in a World Partition map the UWorld keeps the map's own name).
Returns: { actor_name: string, component_name: string, property_name: string, property_type: string (FProperty class name), old_value: string, new_value: string (== final applied value), final_value: string (real value read back off the component), success: bool, value_changed: bool, component_class: string, component_is_active: bool, component_is_registered: bool, world: string (the selector actually used), world_name: string|null, world_package: string|null, world_type: string|null, net_mode: string|null, pie_instance: number }. With verify_persistence=true it also returns { construction_scripts_rerun: bool, has_non_trivial_user_construction_script: bool, post_construction_value: string, survives_construction_script: bool, persistence_note: string, verification: object, verification_checks: [object] }. On failure returns { success:false, error: <precise reason from the importer, or from the world resolver> }.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| world | No | Optional world selector: absent/'editor' is the DEFAULT -- it writes the editor world even with PIE running, which is what persists into the next PIE and what makes CPF_DisableEditOnInstance reachable; 'server' (the live PIE world with authority) | 'client' | 'pie:N' write the RUNNING actor instead; 'pie' is the ambiguous resolution and 'game' its alias. An unrecognised value FAILS with a message naming what was asked for and listing the worlds that exist -- it never falls back to another world in silence. | |
| actor_name | Yes | Name of the actor containing the component. Matched against the actor's OBJECT name (GetName) only -- not its editor label. | |
| property_name | Yes | Name of the property to set | |
| component_name | Yes | Name of the component | |
| property_value | No | New value. Any JSON type: a bare string (e.g. "/Game/Foo.Foo" object path, "Movable" enum name, "A.B.C" gameplay tag, "(X=1,Y=2,Z=3)" struct text), a number/bool, or nested JSON (a struct object, an array for array/set/tag-container props, an object for map props). Strings still import via ImportText_Direct so prior callers keep working. | |
| verify_persistence | No | Optional bool, default false. When true, run AActor::RerunConstructionScripts() and re-read the property to find out whether the value SURVIVES the User Construction Script. Without this, value_changed:true is measured BEFORE the UCS runs, so a property the UCS recomputes (the classic case: RelativeScale3D on a spline/box the UCS rescales) reports as changed and is silently reverted a moment later. Costs a full component rebuild of that actor, and it re-runs in whichever world you selected. |