add_component_to_actor
Attach a new component to an actor already placed in the level, returning its object path for immediate property or function setup. Use idempotent=true to avoid duplicates.
Instructions
Attach a new component of a given class to an actor ALREADY PLACED in the level (an instance-level component, not a change to its Blueprint -- for that use add_component_to_blueprint, which affects every instance). Returns object_path, the full reflection path to feed straight into set_property_value / call_function to configure it, so no dedicated add_* wrapper is needed. Pass idempotent=true to make re-running safe. Editor world only; the change dirties the actor's package, so save_level to keep it.
Returns: { actor_name: string, component_name: string, object_path: string, requested_component_name: string, component_type: string, already_existed: bool, success: bool }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scale | No | Optional [x, y, z] relative scale (for scene components) | |
| location | No | Optional [x, y, z] relative location (for scene components) | |
| rotation | No | PREFERRED: the OBJECT {"roll":R,"pitch":P,"yaw":Y} (any subset, absent axes are 0). The ARRAY form below is [pitch, yaw, roll] -- its index 2 is ROLL, NOT yaw, which once put a PlayerStart on its side. Optional [pitch, yaw, roll] relative rotation (for scene components) | |
| actor_name | Yes | Name of the placed actor to add the component to (editor world). | |
| idempotent | No | Optional bool (default false). When true, if the actor already has a component of this class, return it instead of adding a duplicate (already_existed:true). Use for single-instance components. | |
| component_name | Yes | Name to assign to the new component | |
| component_type | Yes | Component class name (e.g., 'StaticMeshComponent', 'BoxComponent', 'UStaticMeshComponent') |