# Actor.GetComponents() returns Null for blueprint generated actor

**URL:** <https://forums.unrealengine.com/t/actor-getcomponents-returns-null-for-blueprint-generated-actor/452964>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [July 28, 2019, 5:48pm UTC](https://forums.unrealengine.com/t/actor-getcomponents-returns-null-for-blueprint-generated-actor/452964 "2019-07-28T17:48:46Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![M.Haenssgen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@M.Haenssgen](https://forums.unrealengine.com/u/M.Haenssgen)\
**Post date:** [November 28, 2020, 4:14pm UTC](https://forums.unrealengine.com/t/actor-getcomponents-returns-null-for-blueprint-generated-actor/452964/8 "2020-11-28T16:14:36Z")

</div>

Hello,

I don’t expect to have made it in time, but I want to leave this here for everyone who is having this exact problem (like you and me).

The solution is to access the Construction script of the blueprint, there you get the USCSNodes - the complete component hierarchy as a list, if you want - and then you convert those nodes to USceneComponents.

I do this with those two methods:

```
TArray<USCS_Node*> USOLIDBPFunctionLibrary::GetAllBlueprintNodes(UBlueprint* Blueprint)
{
    TArray<USCS_Node*> uscsNodes;
    if (Blueprint != NULL)
    {
        uscsNodes = Blueprint->SimpleConstructionScript->GetAllNodes();
    }
    return uscsNodes;
}

```

To convert the nodes individually you can use this function:

```
USceneComponent* SOLIDBPFunctionLibrary::GetComponentFromNode(USCS_Node* Node)
{
    if (Node != NULL)
    {
        return Cast<USceneComponent>(Node->ComponentTemplate);
    }
    return nullptr;
}

```

But for sure it would be cooler if “GetAllComponents” would actually work on the received CDO of a blueprint, which still does not.

Kind regards,

Mirko

---

_[View the full topic](https://forums.unrealengine.com/t/actor-getcomponents-returns-null-for-blueprint-generated-actor/452964)._
