add-component
Add and configure a UE component on an existing actor class.
SKILL.mdUnrealEngine/skills/add-component/SKILL.md
GitHubAdd & Configure Components (Unreal Engine 5.9)
Use Epic's native EditorToolset.ActorToolset, BlueprintToolsets.BlueprintToolset, EditorToolset.ObjectToolset, and EditorToolset.AssetToolset (invoked via call_tool on /mcp using module-qualified toolset_name values) to manage component hierarchies on Blueprint assets and level actors.
Workflow
- Inspect Existing Component Hierarchy:
- For a level
AActorinstance, callEditorToolset.ActorToolset.GetComponents(plusEditorToolset.ActorToolset.GetRootComponentandEditorToolset.ActorToolset.GetParentComponent) to inspect existing components and parent-child relationships. - For a Blueprint asset, inspect its structure with
BlueprintToolsets.BlueprintDslToolset.Reador load its generated CDO viaBlueprintToolsets.BlueprintToolset.GetDefaultObject.
- For a level
- Add or Reparent the Component:
- Call
EditorToolset.ActorToolset.AddComponentwith:Owner: Target actor Blueprint, actor instance, or parentUSceneComponentComponentType: Component class (e.g.,StaticMeshComponent,SphereComponent,CapsuleComponent,AudioComponent,NiagaraComponent,WidgetComponent, or a custom C++/Blueprint component class)Name: Component name
- Reparent scene components using
EditorToolset.ActorToolset.SetParentComponent(Component,Parent), or delete withEditorToolset.ActorToolset.RemoveComponent(Component).
- Call
- Configure Component Properties & Transform:
- Call
EditorToolset.ObjectToolset.SetProperties(Instance,ValuesJSON string) on the component template or instance to configure properties (StaticMesh,OverrideMaterials[0],BodyInstance.CollisionProfileName, gameplay properties, etc.). Inspect property names first withEditorToolset.ObjectToolset.ListPropertiesorEditorToolset.ObjectToolset.GetPropertySchema. - Use
EditorToolset.ActorToolset.SetComponentTransform(Component,Translation,Rotation,Scale,bWorldSpace) for relative/world transform adjustments.
- Call
- Compile & Save:
- When modifying a Blueprint asset, call
BlueprintToolsets.BlueprintToolset.CompileBlueprint(Blueprint) andEditorToolset.AssetToolset.SaveAsset(AssetPath) to persist changes.
- When modifying a Blueprint asset, call