I have a APuzzlePiece made up of APuzzleBlock, and the blocks have functions to help build valid PuzzlePieces. How do I go about constructing a PuzzlePiece out of PuzzleBlocks? I could do it in Blueprint easily enough with the Add Child Actor Component, but I’m very confused about UChildActorComponent. It doesn’t seem to be working so I must have something wrong due to misconception about this type.
This is what I have in the PuzzlePiece Constructor:
NewBlock = CreateDefaultSubobject<UChildActorComponent>(TEXT("PieceBlock0"));
if (NewBlock)
{
const TSubclassOf<APuzzleBlock> BlockClass;
NewBlock->SetChildActorClass(BlockClass);
NewBlock->CreateChildActor();
}
But when I run this, No child actor appears in world. Please help!