UChildActorComponent::SetChildActorClass

Sets then class to use for the child actor providing an optional Actor to use as the template.

Choose your operating system:

Windows

macOS

Linux

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Components/ChildActorComponent.h

Include

#include "Components/ChildActorComponent.h"

Source

/Engine/Source/Runtime/Engine/Private/Components/ChildActorComponent.cpp

Syntax

void SetChildActorClass
(
    TSubclassOf< AActor > InClass,
    AActor * NewChildActorTemplate
)

Remarks

Sets then class to use for the child actor providing an optional Actor to use as the template. If called on a template component (owned by a CDO) and NewChildActorTemplate is not null, the new child actor template will be created using the supplied Actor as template. If called on a template component and NewChildActorTemplate is null, the properties of any existing child actor template will be copied as best possible to the template. If called on a component instance in a world with NewChildActorTemplate not null, then if registered a new child actor will be created using the supplied Actor as template, otherwise if not registered it will ensure. If the class also changed, then future ChildActors created by this component the class defaults will be used. If called on a component instance in a world with NewChildActorTemplate null and the class is changing, the created ChildActor will use the class defaults as template.

Parameters

Parameter

Description

InClass

The Actor subclass to spawn as a child actor

NewChildActorTemplate

An Actor to use as the template when spawning a child actor using this component (per the rules listed above)