# OnComponentHit stopped working after renaming delagate function

**URL:** <https://forums.unrealengine.com/t/oncomponenthit-stopped-working-after-renaming-delagate-function/368653>\
**Category:** World Creation\
**Tags:** oncomponenthit, unreal-engine, Collision, CPP, question\
**Created:** [August 29, 2016, 5:06pm UTC](https://forums.unrealengine.com/t/oncomponenthit-stopped-working-after-renaming-delagate-function/368653 "2016-08-29T17:06:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_44ea4ec1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_44ea4ec1](https://forums.unrealengine.com/u/anonymous_user_44ea4ec1)\
**Post date:** [August 29, 2016, 5:06pm UTC](https://forums.unrealengine.com/t/oncomponenthit-stopped-working-after-renaming-delagate-function/368653/1 "2016-08-29T17:06:54Z")

</div>

Initially this code was working from constructor of a class derived from ACharacter:

```
auto capsule = GetCapsuleComponent();
capsule->OnComponentHit.AddDynamic(this, &APhageCharacter::onHit);
capsule->BodyInstance.SetResponseToChannel(ECollisionChannel::ECC_WorldDynamic, ECR_Overlap);

```

After encountering wierd problem with Behavior Tree not running I created copy of the class with different name. This solved the problem with Behavior Tree (?!!!). However OnComponentHit stopped working. So I returned to original class. After some experiments it turns out that APhageCharacter::onHit is always called on hit. Even after removing call to AddDynamic(this, &APhageCharacter::onHit). Renaming function to onPhageHit causes OnComponentHit to stop working. Even with proper call to AddDynamic.  
I am completely lost and can not get working OnComponentHit events.
