How to get sub-objects of an actor in C++

Is there a function in C++ that returns or gives you the subojects of an actor. I have searched through the documentation but couldn’t find anything there.

subobjects? Do you mean Components? If so, GetComponents()

TArray<UObject*>Children;

ForEachObjectWithOuter(Object, [&Children] (UObject*Chid){ Children.Add(Chid); }, true);

for (const auto &OBJ : Children)
{
	OBJ-> // ....
}
1 Like

So, what goes in each of these parameters. Can you please explain.

From the source file:
Runtime\CoreUObject\Public\UObject\UObjectHash.h

If you’re having trouble with the second parameter, that’s a C++ Lambda function. Ex.:

auto MyLambdaFunction = [&Children] (UObject* Chid)
{
    Children.Add(Chid);
}