# Should FGameplayTargetDataFilter::SelfActor instead be TWeakObjectPtr? 

**URL:** <https://forums.unrealengine.com/t/should-fgameplaytargetdatafilter-selfactor-instead-be-tweakobjectptr/2855748>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, Epic-Pro-Support, question\
**Created:** [September 30, 2026, 9:59pm UTC](https://forums.unrealengine.com/t/should-fgameplaytargetdatafilter-selfactor-instead-be-tweakobjectptr/2855748 "2026-09-30T21:59:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [September 30, 2026, 9:59pm UTC](https://forums.unrealengine.com/t/should-fgameplaytargetdatafilter-selfactor-instead-be-tweakobjectptr/2855748/1 "2026-09-30T21:59:52Z")

</div>

We were diagnosing a crash that we saw where FGameplayTargetDataFilter SelfActor was not zeroed out by GC as would be expected from a TObjectPtr UPROPERTY because the FGameplayTargetDataFilterHandle only stores a reference to the FGameplayTargetDataFilter by TSharedPtr, preventing SelfActor from being considered actively referenced when GC runs.

We could fix our crash by making sure target data filters are not held across frames (though I’m not seeing any docs/comments explicitly stating this is an unsafe practice), but it got me thinking about whether or not the SelfActor property should be a TWeakObjectPtr instead. It seems like the ideal behavior would be for the filter to gracefully handle the SelfActor getting cleaned up, rather than preventing it from getting GC’d. I don’t see any changes to this in UE5, so I wanted to run this by you all to see if you think changing it to a TWeakObjectPtr makes sense?

[Attachment Removed]

---

<div class="post-metadata">

**Author:** ![ZhiKangShao](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zhikangshao/32/1089997_2.png) [@ZhiKangShao](https://forums.unrealengine.com/u/ZhiKangShao)\
**Post date:** [October 15, 2026, 2:24pm UTC](https://forums.unrealengine.com/t/should-fgameplaytargetdatafilter-selfactor-instead-be-tweakobjectptr/2855748/2 "2026-10-15T14:24:44Z")

</div>

That’s a good catch. I agree with your assessment with TSharedPtr causing the reference not to be nulled and TWeakObjectPtr being a cleaner fix. Because we’re focusing on UE6 we’re not going to make that change, but in my opinion that’s a good change to make locally.

[Attachment Removed]

---

<div class="post-metadata">

**Author:** ![ZhiKangShao](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zhikangshao/32/1089997_2.png) [@ZhiKangShao](https://forums.unrealengine.com/u/ZhiKangShao)\
**Post date:** [October 15, 2026, 2:40pm UTC](https://forums.unrealengine.com/t/should-fgameplaytargetdatafilter-selfactor-instead-be-tweakobjectptr/2855748/3 "2026-10-15T14:40:20Z")

</div>

Sounds great!

[Attachment Removed]

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [October 15, 2026, 2:37pm UTC](https://forums.unrealengine.com/t/should-fgameplaytargetdatafilter-selfactor-instead-be-tweakobjectptr/2855748/4 "2026-10-15T14:37:36Z")

</div>

Good to know, we went ahead and modified it locally a while ago and haven’t seen any issues stem from it so far.

Thanks.

[Attachment Removed]
