# The way I add Components to Actor via Editor Utility Widget

**URL:** <https://forums.unrealengine.com/t/the-way-i-add-components-to-actor-via-editor-utility-widget/677903>\
**Category:** Blueprint\
**Tags:** actor-blueprint, unreal-engine\
**Created:** [October 27, 2022, 2:17am UTC](https://forums.unrealengine.com/t/the-way-i-add-components-to-actor-via-editor-utility-widget/677903 "2022-10-27T02:17:33Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![haruhito\_o](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@haruhito\_o](https://forums.unrealengine.com/u/haruhito_o)\
**Post date:** [October 27, 2022, 2:17am UTC](https://forums.unrealengine.com/t/the-way-i-add-components-to-actor-via-editor-utility-widget/677903/1 "2022-10-27T02:17:34Z")

</div>

If you want to add Components to your Actor in EUW, your scripts will be something like this.

 ![bandicam 2022-10-27 10-08-54-011](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/9/c/d9c3ac292a044288f18cdd487ea55b50afcc3886.jpeg)

In my situation, this will not work as it is expected.  
I added Box Component, and it appears in Scene, but not in details panel.  
And, If I move the Actor, the box will disapper.

 ![bandicam 2022-10-27 10-13-35-650](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/7/c/27cdf513c3ec161f848d41f0d7a23f539e8ed7b7.jpeg)

There is a reason for this, but it’s tricky.  
If You copy the actor and paste it into text editor, You can get something like this.

```auto
Begin Map
   Begin Level
      Begin Actor Class=/Script/Engine.Actor Name=Actor_0 Archetype=/Script/Engine.Actor'/Script/Engine.Default__Actor'
         Begin Object Class=/Script/Engine.SceneComponent Name="DefaultSceneRoot"
         End Object
         Begin Object Class=/Script/Engine.BoxComponent Name="BoxComponent_0"
         End Object
         Begin Object Name="DefaultSceneRoot"
            bVisualizeComponent=True
            CreationMethod=Instance
         End Object
         Begin Object Name="BoxComponent_0"
            AreaClass=Class'"/Script/NavigationSystem.NavArea_Obstacle"'
            AttachParent=SceneComponent'"DefaultSceneRoot"'
            CreationMethod=UserConstructionScript
         End Object
         RootComponent=SceneComponent'"DefaultSceneRoot"'
         ActorLabel="Actor"
         InstanceComponents(0)=SceneComponent'"DefaultSceneRoot"'
      End Actor
   End Level
Begin Surface
End Surface
End Map

```

BoxComponent has a property called “CreationMethod”. By default,the value will be “userConstructionScript”, when the component was made via blueprints.

That is causing a problem.

If I change the value to “Instance” in text editor, and paste back to UE, the components will show up correctly.

 ![bandicam 2022-10-27 10-17-53-210](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/3/b/63b92380066b6a02ef0094cf05af57fcf3618f5f.jpeg)

So, I have to change “CreationMethod” from “UserConstructionScript” to “Instance”, when I add component in Blueprint.

The way I found is creat a cutsom blueprint node by using c++.

C++ offers a functionaily to do that. Here is a sample of my custom blueprint.

Custom\_BP\_LibraryBPLibrary.cpp

```auto
#include "Custom_BP_LibraryBPLibrary.h"
#include "Custom_BP_Library.h"

#include "ComponentInstanceDataCache.h"

UActorComponent* UCustom_BP_LibraryBPLibrary::SetCreationMethod(UActorComponent* ActorComponent, EComponentCreationMethod method)
{
	if (ActorComponent != nullptr) {
		ActorComponent->CreationMethod = method;
	}
	return ActorComponent;
}

```

Custom\_BP\_LibraryBPLibrary.h

```auto
#pragma once

#include "Kismet/BlueprintFunctionLibrary.h"
#include "Custom_BP_LibraryBPLibrary.generated.h"

UCLASS()
class UCustom_BP_LibraryBPLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_UCLASS_BODY()

		UFUNCTION(BlueprintCallable, Category = "Custom_BP_LibraryTesting")
		static UActorComponent* SetCreationMethod(UActorComponent* ActorComponent, EComponentCreationMethod method);

};

```

 ![bandicam 2022-10-27 10-20-13-654](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/b/d/3bd42597e1082cf85c2dd2b1f92bd94c730f9245.jpeg)

If I put this node after adding component, now I can add any components to Actor by using this Editor Utility Widget.

But there is another small problem left.

If I add component to my Actor, sometimes the component will not show up in details panel.  
Refreshing details panel by selecting other Actor makes it show up.  
So the script is surely working, but something is going wrong.

I encounterd very complicated process through fixing those issues, and something remain unsolved.  
I think there must be things that need to be fixed.  
what do you think?

Any help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![anon10386587](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon10386587](https://forums.unrealengine.com/u/anon10386587)\
**Post date:** [November 14, 2022, 4:13pm UTC](https://forums.unrealengine.com/t/the-way-i-add-components-to-actor-via-editor-utility-widget/677903/2 "2022-11-14T16:13:12Z")

</div>

Hello!  
I’ve used your method to add a component from a editor utility widget and it works perfectly !  
However, I want to remove the component but i’ve only found the “DestroyComponent” node but it doesn’t seem to work.  
Do you have any idea on how can i remove my component ?

---

<div class="post-metadata">

**Author:** ![tumi23](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tumi23](https://forums.unrealengine.com/u/tumi23)\
**Post date:** [December 12, 2022, 5:20pm UTC](https://forums.unrealengine.com/t/the-way-i-add-components-to-actor-via-editor-utility-widget/677903/3 "2022-12-12T17:20:58Z")

</div>

I’d like to add after having problems with the asset not saving that you need to also “Transact” the object so the engine knows it has been edited. Otherwise once the component gets added, save everything and open the level again the actor will have reverted back to how it was before the component was added.

 ![image_2022-12-12_172006301](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/2/f/c2f4802c5b49b2dfb678672acb7bc00c4efe5410.png)

---

<div class="post-metadata">

**Author:** ![Brooks\_Leee11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Brooks\_Leee11](https://forums.unrealengine.com/u/Brooks_Leee11)\
**Post date:** [August 4, 2023, 3:13am UTC](https://forums.unrealengine.com/t/the-way-i-add-components-to-actor-via-editor-utility-widget/677903/4 "2023-08-04T03:13:37Z")

</div>

Great ! I’ve been struggling with this problem for a while. thanks a lot!

---

<div class="post-metadata">

**Author:** ![WR1978](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@WR1978](https://forums.unrealengine.com/u/WR1978)\
**Post date:** [October 20, 2023, 4:56pm UTC](https://forums.unrealengine.com/t/the-way-i-add-components-to-actor-via-editor-utility-widget/677903/5 "2023-10-20T16:56:08Z")

</div>

Great job [haruhito\_o](https://forums.unrealengine.com/u/haruhito_o)!  
After adding component, Details window will not update. But you can use UpdateEditorWindow function/node.

UFUNCTION(BlueprintCallable)  
static void UpdateEditorWindow(AActor\* TargetActor)  
{  
// Deselect the actor  
GEditor-\>SelectActor(TargetActor, false, true);

```
	// Reselect the actor
	GEditor->SelectActor(TargetActor, true, true);

	// Notify the editor that the selection changed (this can force a details panel refresh)
	GEditor->NoteSelectionChange();
	
}

```

but remember to add #include “Editor.h”  
and update your Build.cs file with “UnrealEd”  
PublicDependencyModuleNames.AddRange(new string { Your modules, “UnrealEd” });

---

<div class="post-metadata">

**Author:** ![WR1978](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@WR1978](https://forums.unrealengine.com/u/WR1978)\
**Post date:** [October 23, 2023, 8:57am UTC](https://forums.unrealengine.com/t/the-way-i-add-components-to-actor-via-editor-utility-widget/677903/6 "2023-10-23T08:57:57Z")

</div>

There is one issue left.  
After creating(adding) component , and deleting, and creating once again…Unreal will crush.  
But if we create, delete, save and reload scene, than add again…UE will not crush.

---

<div class="post-metadata">

**Author:** ![ianFisch](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ianFisch](https://forums.unrealengine.com/u/ianFisch)\
**Post date:** [May 9, 2024, 12:55am UTC](https://forums.unrealengine.com/t/the-way-i-add-components-to-actor-via-editor-utility-widget/677903/7 "2024-05-09T00:55:36Z")

</div>

Hi.

So the superior way to do this is to simply call

`YourActor->AddInstanceComponent(YourComponent);`

That automatically changes the CreationMethod to “Instance”. It also makes it so the changes save properly to your actor blueprint.

So you can use features such as “Apply Instance Changes to Blueprint”, and the new component will actually save back to the original actor blueprint.

You can use it like this:

```auto

UPhysicsConstraintComponent* PhysicsConstraintComponent = NewObject<UPhysicsConstraintComponent>(DestructibleStructureActor);
	
DestructibleStructureActor->AddInstanceComponent(PhysicsConstraintComponent);

PhysicsConstraintComponent->RegisterComponent();

PhysicsConstraintComponent->AttachToComponent(DestructibleStructureActor->GetRootComponent(), FAttachmentTransformRules::KeepWorldTransform);

```

---

<div class="post-metadata">

**Author:** ![PDubulous](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pdubulous/32/1194655_2.png) [@PDubulous](https://forums.unrealengine.com/u/PDubulous)\
**Post date:** [April 2, 2025, 9:23pm UTC](https://forums.unrealengine.com/t/the-way-i-add-components-to-actor-via-editor-utility-widget/677903/8 "2025-04-02T21:23:20Z")

</div>

In 5.3 this can be accomplished by this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/6/9/869f78c75d74da6f6eb08b76678fb8ffb0058f3b.png)

[https://blueprintue.com/blueprint/x60\_fjrp/](https://blueprintue.com/blueprint/x60_fjrp/)

---

<div class="post-metadata">

**Author:** ![ben-mkiv](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ben-mkiv](https://forums.unrealengine.com/u/ben-mkiv)\
**Post date:** [July 21, 2025, 11:00am UTC](https://forums.unrealengine.com/t/the-way-i-add-components-to-actor-via-editor-utility-widget/677903/9 "2025-07-21T11:00:31Z")

</div>

Thank you, the AddInstancedComponent() is the magic sauce, here’s a generic cpp helper method to create components in Editor:

```auto
// creates a instanced component
UFUNCTION(BlueprintCallable, meta=(DeterminesOutputType="ComponentClass", DynamicOutputParam="ReturnValue"))
static UActorComponent* CreateComponent(AActor *TargetActor, TSubclassOf<UActorComponent> ComponentClass, FTransform RelativeTransform, bool bManualAttachment = false)
{
	if(!TargetActor || !ComponentClass)
		return nullptr;

	if(UActorComponent *Component = TargetActor->AddComponentByClass(ComponentClass, bManualAttachment, RelativeTransform, false))
	{
		TargetActor->AddInstanceComponent(Component);
		TargetActor->MarkPackageDirty();
		return Component;
	}

	return nullptr;
}

```

---

<div class="post-metadata">

**Author:** ![xiaoweiwei](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xiaoweiwei](https://forums.unrealengine.com/u/xiaoweiwei)\
**Post date:** [January 13, 2026, 3:20am UTC](https://forums.unrealengine.com/t/the-way-i-add-components-to-actor-via-editor-utility-widget/677903/10 "2026-01-13T03:20:45Z")

</div>

ohhhhhh!!! thanks!!!

---

<div class="post-metadata">

**Author:** ![Arkemica](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Arkemica](https://forums.unrealengine.com/u/Arkemica)\
**Post date:** [June 9, 2026, 3:36pm UTC](https://forums.unrealengine.com/t/the-way-i-add-components-to-actor-via-editor-utility-widget/677903/11 "2026-06-09T15:36:35Z")

</div>

Guys, from the bottom of my heart, thank you so much!!!

---

<div class="post-metadata">

**Author:** ![DionXein](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dionxein/32/1186677_2.png) [@DionXein](https://forums.unrealengine.com/u/DionXein)\
**Post date:** [June 25, 2026, 12:19pm UTC](https://forums.unrealengine.com/t/the-way-i-add-components-to-actor-via-editor-utility-widget/677903/12 "2026-06-25T12:19:41Z")

</div>

That’s gives new sight on how to deal with components! By the way, is there any option to delete subobjects in EUW? Found “Delete subobjects from Blueprint” but it reacts like

> `LogSubobjectSubsystem: Warning: Cannot delete subobject ‘SM\_Cone12\_StaticMeshComponent0’ from ‘BP\_Pillars\_n\_Cone\_C /Game/Maps/BaseMap.BaseMap:PersistentLevel.BP\_Pillars\_n\_Cone\_C\_2’!

 ![delcomponent](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/5/e/a5e6d88919c98901c0b956f61770ecfc57f87c3e.jpeg)
