# Get a reference to component owner while in blueprint editor

**URL:** <https://forums.unrealengine.com/t/get-a-reference-to-component-owner-while-in-blueprint-editor/568421>\
**Category:** C++\
**Tags:** actor-blueprint, unreal-engine, UE5-0, Components, question, Blueprint\
**Created:** [May 28, 2022, 5:28am UTC](https://forums.unrealengine.com/t/get-a-reference-to-component-owner-while-in-blueprint-editor/568421 "2022-05-28T05:28:17Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![JornamGregor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JornamGregor](https://forums.unrealengine.com/u/JornamGregor)\
**Post date:** [October 3, 2022, 2:23pm UTC](https://forums.unrealengine.com/t/get-a-reference-to-component-owner-while-in-blueprint-editor/568421/4 "2022-10-03T14:23:45Z")

</div>

For anyone Googling this, I found my solution here: [Actor.GetComponents() returns Null for blueprint generated actor - #8 by M.Haenssgen](https://forums.unrealengine.com/t/actor-getcomponents-returns-null-for-blueprint-generated-actor/452964/8)

In the editor, the component has no owner, but you can use the the blueprint generated class outer, which leads you to the “nodes” (aka components).

```auto
	TArray<FString> options;

	UBlueprintGeneratedClass* owningGenClass = Cast<UBlueprintGeneratedClass>(GetOuter());
	if (owningGenClass == nullptr)
	{
		return options;
	}
	const TObjectPtr<USimpleConstructionScript> constructionScript = owningGenClass->SimpleConstructionScript;
	if (constructionScript == nullptr)
	{
		return options;
	}
	for (const USCS_Node* component : constructionScript->GetAllNodes())
	{
		const UMeshComponent* meshComponent = Cast<UMeshComponent>(component->ComponentTemplate);
		if (meshComponent != nullptr)
		{
			FName name = component->GetVariableName();
			if ( ! meshComponents.Contains(name))
			{
				options.Add(name.ToString());
			}
		}
	}
	return options;

```

---

_[View the full topic](https://forums.unrealengine.com/t/get-a-reference-to-component-owner-while-in-blueprint-editor/568421)._
