# Creating an overlap function - FWeakObjectPtr?

**URL:** <https://forums.unrealengine.com/t/creating-an-overlap-function-fweakobjectptr/291424>\
**Category:** World Creation\
**Tags:** convert, overlap, unreal-engine, Collision, CPP, question\
**Created:** [August 19, 2014, 3:25pm UTC](https://forums.unrealengine.com/t/creating-an-overlap-function-fweakobjectptr/291424 "2014-08-19T15:25:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_44db827a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_44db827a](https://forums.unrealengine.com/u/anonymous_user_44db827a)\
**Post date:** [August 19, 2014, 3:25pm UTC](https://forums.unrealengine.com/t/creating-an-overlap-function-fweakobjectptr/291424/1 "2014-08-19T15:25:57Z")

</div>

Hey! I am in need of help for converting my overlap function. In 4.4, the console is telling me that I need a “FWeakObjectPtr” variable in the function. I was now wondering if someone could tell me what exactly this variable gives me, how i can use it and most importantly, what type of variable it is and how to implement it (sorry, I am still learning my C++ so this is something that I need to know):

```
UFUNCTION()
	void OnOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool hasCollided, const FHitResult& Hit, const FWeakObjectPtr ?);

```

---

<div class="post-metadata">

**Author:** ![LBandy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LBandy](https://forums.unrealengine.com/u/LBandy)\
**Post date:** [August 20, 2014, 11:53am UTC](https://forums.unrealengine.com/t/creating-an-overlap-function-fweakobjectptr/291424/2 "2014-08-20T11:53:47Z")

</div>

Use the following signature:

void OnOverlap(class AActor\* OtherActor, class UPrimitiveComponent\* OtherComp, int32 OtherBodyIndex, bool fromSweep, const FHitResult& result);

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_44db827a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_44db827a](https://forums.unrealengine.com/u/anonymous_user_44db827a)\
**Post date:** [August 20, 2014, 5:52pm UTC](https://forums.unrealengine.com/t/creating-an-overlap-function-fweakobjectptr/291424/3 "2014-08-20T17:52:51Z")

</div>

It worked, thank you! So i don’t need FWeakObjectPtr…but then what does it do? Is it merely the information sent from the collider? Im still a bit confused tbh

---

<div class="post-metadata">

**Author:** ![VSZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@VSZ](https://forums.unrealengine.com/u/VSZ)\
**Post date:** [November 11, 2014, 3:32pm UTC](https://forums.unrealengine.com/t/creating-an-overlap-function-fweakobjectptr/291424/4 "2014-11-11T15:32:35Z")

</div>

I’d like to know this as well, I’ve seen this used in TArray declarations in places like Actor.h but I’m not really sure when I should be using this and what implications it has on garbage collection…
