Navigation
API > API/Runtime > API/Runtime/Engine > API/Runtime/Engine/AActor
Description
Creates a new component and assigns ownership to the Actor this is called for. Automatic attachment causes the first component created to become the root, and all subsequent components to be attached under that root. When bManualAttachment is set, automatic attachment is skipped and it is up to the user to attach the resulting component (or set it up as the root) themselves.
| Name | AddComponentByClass |
| Type | function |
| Header File | /Engine/Source/Runtime/Engine/Classes/GameFramework/Actor.h |
| Include Path | #include "GameFramework/Actor.h" |
| Source | /Engine/Source/Runtime/Engine/Private/ActorConstruction.cpp |
UFUNCTION (BlueprintCallable,
Meta=(ScriptNoExport, BlueprintInternalUseOnly="true", InternalUseParam="bDeferredFinish"))
UActorComponent * AddComponentByClass
(
TSubclassOf < UActorComponent > Class,
bool bManualAttachment,
const FTransform & RelativeTransform,
bool bDeferredFinish
)
Parameters
| Name | Remarks |
|---|---|
| Class | The class of component to create |
| bManualAttachment | Whether manual or automatic attachment is to be used |
| RelativeTransform | The relative transform between the new component and its attach parent (automatic only) |
| bDeferredFinish | Whether or not to immediately complete the creation and registration process for this component. Will be false if there are expose on spawn properties being set |