Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to get list of blueprint child components at compile time in editor?

Working in a custom C++ component, I'm trying to pull a list of child components when PostEditChangeProperty() is called (when a change is made to the component in the editor). However with my current setup, it always returns 0 child components, even when I know this to be false and have manually added child components myself.

Here is the incorrect code I currently have:

 void UPickupObjectComponent::PostEditChangeProperty(FPropertyChangedEvent & e)
     TArray<USceneComponent*> Meshes;
     GetChildrenComponents(false, Meshes);
     if (Meshes.Num() > 0) {
         UE_LOG(LogTemp, Warning, TEXT("Found %d static meshes"), Meshes.Num());
         for (int i = 0; i < Meshes.Num(); i++) {
             if (Meshes[i]->IsA(UStaticMeshComponent::StaticClass())) {
                 ChildMesh = Cast<UStaticMeshComponent>(Meshes[i]);

If I try to call GetChildrenComponents in the blueprint construction script it works. Is there a different function I need to call in c++ to get it to work in editor?

Product Version: UE 4.16
more ▼

asked Dec 18 '17 at 03:27 PM in C++ Programming

avatar image

3 1 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Here is the function you need. It will fire for each attached component at compile


 virtual void OnChildAttached(USceneComponent* childComponent) override;


 void UPickupObjectComponent::OnChildAttached(USceneComponent* ChildComponent)
     //Your code here
more ▼

answered Feb 14 '18 at 01:58 PM

avatar image

88 3 4 7

avatar image Finlaymcd Feb 27 '18 at 08:10 PM

Thanks very much, I went for a different solution in the end but this will be useful in the future.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question