# BlueprintNativeEvent - Override TestFunc in grandchild, then child, results in grandchild's override becoming TestFunc\_0

**URL:** <https://forums.unrealengine.com/t/blueprintnativeevent-override-testfunc-in-grandchild-then-child-results-in-grandchilds-override-becoming-testfunc-0/386818>\
**Category:** Blueprint\
**Tags:** child-class, unreal-engine, bug-report, Blueprint, CPP, question\
**Created:** [March 3, 2017, 8:24am UTC](https://forums.unrealengine.com/t/blueprintnativeevent-override-testfunc-in-grandchild-then-child-results-in-grandchilds-override-becoming-testfunc-0/386818 "2017-03-03T08:24:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_987ed909](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_987ed909](https://forums.unrealengine.com/u/anonymous_user_987ed909)\
**Post date:** [March 3, 2017, 8:24am UTC](https://forums.unrealengine.com/t/blueprintnativeevent-override-testfunc-in-grandchild-then-child-results-in-grandchilds-override-becoming-testfunc-0/386818/1 "2017-03-03T08:24:57Z")

</div>

If I have an abstract parent class with BlueprintNativeEvent, the child class can override my function fine and will call the function when called by its base class in the world. However, I remove this function - I do not need it. Instead, I create a grandchild that overrides the function. In a vacuum, this normally works (although sometimes it does not, but I can’t reproduce it reliably).

However, if I return to the child class and override the function, the grandchild’s override becomes a new function entirely.

**Reproducing the problem:**

I have an abstract class in C++. We’ll call it _Parent_.

```
UCLASS(abstract, Blueprintable)
class PROJECT_API AParent : public AActor
{
	GENERATED_BODY()

public:
	// Sets default values for this character's properties
	AParent();

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

	UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
	bool TestFunc();
//Etc...

```

In my cpp file TestFunc looks like this:

```
bool AParent::TestFunc_Implementation()
{
	unimplemented()
	return false;
}

```

This compiles fine. I will now go into Unreal Engine 4’s editor and _Create Blueprint class based on Parent_. We’ll name this blueprint class Child.

And now this is where the problem arises. I will _Create Blueprint class based on Child_. I call it _Grandchild_… All it does is override _Test Func_ and print out “Grandchild”. I now go and override Test Func in _Child_.

I drop Grandchild into the world. I go into Level Blueprint, and on BeginPlay() tell it to…

- Get all by class: Parent → For Each Loop
- For Each Loop → Loop Body
- Loop Body → Test Func

![128557-functioncall.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/7/a/97a01cafe5581d822b59c5c33405faf2b99c0ed7.png)

And now the problem: It prints “Child,” not “Grandchild”…

What seems to happen is that if _Grandchild_ has Test Func defined and we then also override in parent, _Grandchild_’s Test Func becomes Test Func 0, which is not the same function.

 ![128558-functionoutput.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/c/d/fcd93629b5996ae08d2a06048e029498022d2320.png)

**Note:**

This problem does not occur that I can tell if the original function is of type void, ie…

```
 //.h file
 UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
 void TestFunc();

```

And…

```
  //.cpp
 void AParent::TestFunc_Implementation()
 {
     unimplemented()
 }

```

-

---

<div class="post-metadata">

**Author:** ![pulp\_user](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@pulp\_user](https://forums.unrealengine.com/u/pulp_user)\
**Post date:** [March 3, 2017, 8:38am UTC](https://forums.unrealengine.com/t/blueprintnativeevent-override-testfunc-in-grandchild-then-child-results-in-grandchilds-override-becoming-testfunc-0/386818/2 "2017-03-03T08:38:00Z")

</div>

> `bool AParent::TestFunc_Implementation() { unimplemented() return false; }`

You define this in your cpp, but don’t declare it in your .h? Or did you just not show that part of your .h? That might be it.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_987ed909](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_987ed909](https://forums.unrealengine.com/u/anonymous_user_987ed909)\
**Post date:** [March 3, 2017, 9:52am UTC](https://forums.unrealengine.com/t/blueprintnativeevent-override-testfunc-in-grandchild-then-child-results-in-grandchilds-override-becoming-testfunc-0/386818/3 "2017-03-03T09:52:30Z")

</div>

The first code section is the .h file, TestFunc is the virtual func, TestFunc\_Implementation is the implementation of the virtual func in the abstract parent class.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_41845f4a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_41845f4a](https://forums.unrealengine.com/u/anonymous_user_41845f4a)\
**Post date:** [March 9, 2017, 3:07pm UTC](https://forums.unrealengine.com/t/blueprintnativeevent-override-testfunc-in-grandchild-then-child-results-in-grandchilds-override-becoming-testfunc-0/386818/4 "2017-03-09T15:07:00Z")

</div>

Hello Drunkenvalley,

Thank you for reporting this issue. I’ve placed a bug report in for this issue which you can find here: [UE-42687](https://issues.unrealengine.com/issue/UE-42687). It seems that the issue you’re seeing is dependent on the order that the overrides are created in, deferring to the newly created ones in inherited classes, so you should be able to workaround it in the time being with that knowledge.

Have a nice day!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_987ed909](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_987ed909](https://forums.unrealengine.com/u/anonymous_user_987ed909)\
**Post date:** [March 9, 2017, 6:48pm UTC](https://forums.unrealengine.com/t/blueprintnativeevent-override-testfunc-in-grandchild-then-child-results-in-grandchilds-override-becoming-testfunc-0/386818/5 "2017-03-09T18:48:01Z")

</div>

Yes, we worked around it to, but boy was it frustrating when we were having “Child” rather than “Grandchild” printed. 😛 (Not literally those names, but.)
