Can we have a function like UChildActorComponent->SetChildActor(AActor*) ?

Hello,

i want to spawn a NAMED Actor via a ChildActorComponent

When i use this function: SetChildActorClass

ChildActorComponent->SetChildActorClass(ActorClass)

The ChildActorComponent will spawn an actor with the given class but i have no control on the actor name that will be spawned

I would need a function like: SetChildActor

ChildActorComponent->SetChildActor(Actor)

that will spawn an Actor with a name i could have set before (maybe with the help of SpawnActorDeferred or with a spawned actor that i will attach to the ChildActorComponent using SetChildActor)

Thanks

You could subclass UChildActorComponent and put your SetChildActor() function here, looking at UChildActorComponent::CreateChildActor() implementation in order to properly attach the child actor. However it looks like UChildActorComponent has been made to have complete control of the created child actor, so are you sure you need to create your child actor externally? Probably a better design would be to let UChildActorComponent create your child actor.

Thanks i will do this, i am new to ue4/c++ and i didnt even think bout subclassing uchildactorcomponent