Get All Components of a Blueprint in C++

Hello,

I’m looking for all the components and child components of a Blueprint in C++.
User choose a Blueprint object in Editor (that set a " UBlueprint* " variable in my C++ class), and after it I want to get all Components of it.

I have searched in many posts about this kind of question but nothing resolved my problem.

I can get the Default Object with : bp->GeneratedClass->GetDefaultObject(), but i’m just able to get the Static Mesh component, but I can’t have its children.

Thank you in advance.

Guillaume

Yes it returns an empty array :frowning:

Did you maybe try this?

I found a solution : you can get an instance of AActor corresponding to your UBlueprint variable by using :
MyBP->SimpleConstructionScript->GetComponentEditorActorInstance()
And after, I use GetRootComponent()->GetChildrenComponents.
BUT, when using this function, you need to have your BP to be opened in editor in order to get the components. So you get the instance that UE editor create when you’re editing your asset, that’s why if you don’t open it you can’t have the instance given by this function.