# Getting Actor of FProperty instance

**URL:** <https://forums.unrealengine.com/t/getting-actor-of-fproperty-instance/485680>\
**Category:** C++\
**Tags:** properties, UProperty, actor, unreal-engine, cast, question, CPP\
**Created:** [July 2, 2021, 3:55pm UTC](https://forums.unrealengine.com/t/getting-actor-of-fproperty-instance/485680 "2021-07-02T15:55:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jojothebandit](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jojothebandit](https://forums.unrealengine.com/u/jojothebandit)\
**Post date:** [July 2, 2021, 3:55pm UTC](https://forums.unrealengine.com/t/getting-actor-of-fproperty-instance/485680/1 "2021-07-02T15:55:06Z")

</div>

Hello,

If I have an cpp component I can easily get the actor “i am in” with GetOwner()

But if I’m in plugin code, and have an Insance of a FProperty from some actor, it doesn’t seem I can get the actor instance in any way.  
I can catch the component name from the owner, but can’t make it become the actor. I need the actor name.  
I have tried the following:

```
TSharedPtr<IPropertyHandle> Handle // is a property handle
FProperty* TheProperty = Handle->GetProperty() // Is a FProperty*

//Directly
AActor* TheActor = Cast<AActor>(TheProperty ->GetOwner()); // Doesnt cast, stays nullptr

AActor* TheActor = Cast<AActor>(Handle->GetProperty()->GetOwnerUObject()); // Doesnt cast, stays nullptr

//Through the component

TheComponent = Cast<UActorComponent>(Handle->GetProperty()->GetOwner<UActorComponent>()); // Doesnt cast, stays nullptr
TheActor = Cast<AActor>(TheComponent->GetOwner()); // Doesnt cast, stays nullptr

```

Is there any way to get the actor?  
For some context(simplified), i have made a plugin that when you click a property something happens, so i need to save the name so I know which actor it happened on.

---

<div class="post-metadata">

**Author:** ![jojothebandit](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jojothebandit](https://forums.unrealengine.com/u/jojothebandit)\
**Post date:** [July 2, 2021, 4:18pm UTC](https://forums.unrealengine.com/t/getting-actor-of-fproperty-instance/485680/2 "2021-07-02T16:18:53Z")

</div>

This actually seems to work

```
	TArray<UObject*> OuterObjects;
	Handle->GetOuterObjects(OuterObjects);

	for (int i = 0; i < OuterObjects.Num(); ++i)
	{
		TheComponent = Cast<UActorComponent>(OuterObjects[i]);
		TheActor = Cast<AActor>(TheComponent->GetOwner());
		TheActorName = TheActor->GetName();		
	}

```

But does seem smelly
