# FindFunctionByName always yields nullptr

**URL:** <https://forums.unrealengine.com/t/findfunctionbyname-always-yields-nullptr/1189686>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [June 5, 2023, 3:43pm UTC](https://forums.unrealengine.com/t/findfunctionbyname-always-yields-nullptr/1189686 "2023-06-05T15:43:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fibulator](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fibulator](https://forums.unrealengine.com/u/Fibulator)\
**Post date:** [June 5, 2023, 3:43pm UTC](https://forums.unrealengine.com/t/findfunctionbyname-always-yields-nullptr/1189686/1 "2023-06-05T15:43:40Z")

</div>

if (!Blueprint)  
{  
// Blueprint is null, handle the error  
return;  
}

```
UClass* BlueprintClass = Blueprint->GeneratedClass;
if (!BlueprintClass)
{
	// The blueprint class is null, handle the error
	return;
}

FName FunctionName = FName(TEXT("DestroyActor"));
UFunction* Function = BlueprintClass->FindFunctionByName(FunctionName);
if (!Function)
{
	// The function does not exist in the blueprint class, handle the error
	UE_LOG(LogTemp, Warning, TEXT("Function Not Found"));
	return;
}

```

The Bluepirnt is subclass of Actor  
I’ve tried different variations of “Destroy Actor” and “DestroyActor”, and several other functions, but they always return nullptr. What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![Fibulator](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fibulator](https://forums.unrealengine.com/u/Fibulator)\
**Post date:** [June 5, 2023, 3:49pm UTC](https://forums.unrealengine.com/t/findfunctionbyname-always-yields-nullptr/1189686/2 "2023-06-05T15:49:47Z")

</div>

I see, I had to use “K2\_DestroyActor” as the name.  
I found the name by Right-clicking “Destroy Actor” node on graph, and pasting into text editor, show as “MemberName =”.

---

<div class="post-metadata">

**Author:** ![Fibulator](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fibulator](https://forums.unrealengine.com/u/Fibulator)\
**Post date:** [June 5, 2023, 4:20pm UTC](https://forums.unrealengine.com/t/findfunctionbyname-always-yields-nullptr/1189686/3 "2023-06-05T16:20:35Z")

</div>

This finds some functions, but not others.  
FunctionReference=(MemberParent=/Script/CoreUObject.Class’“/Script/Engine.GameplayStatics”',MemberName=“GetActorOfClass”)

“GetActorOfClass” return nullptr  
but  
K2\_DestroyActor works

FunctionReference=(MemberName=“K2\_DestroyActor”

The difference appears to be “MemberParent”. How can I find functions available for any blueprint class?

I’m trying to get to the point where I add nodes that exist in a plugin “Geometry Scripting” to a blueprint that is a child of “GeneratedDynamicMeshActor”, but it always yields a nullptr.

---

<div class="post-metadata">

**Author:** ![Fibulator](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fibulator](https://forums.unrealengine.com/u/Fibulator)\
**Post date:** [June 5, 2023, 5:06pm UTC](https://forums.unrealengine.com/t/findfunctionbyname-always-yields-nullptr/1189686/4 "2023-06-05T17:06:50Z")

</div>

I get it now. Instead of setting “BlueprintClass” to the class of the blueprint, I have to set it to the class that the function exists in.

“GameplayStatics” UClass In the example of “GetActorOfClass” function
