# Pass \`TAssetPtr\` to \`BlueprintImplementableEvent\`?

**URL:** <https://forums.unrealengine.com/t/pass-tassetptr-to-blueprintimplementableevent/339640>\
**Category:** Pipeline & Plugins\
**Tags:** unreal-engine, CPP, Blueprint, question\
**Created:** [November 25, 2015, 12:21pm UTC](https://forums.unrealengine.com/t/pass-tassetptr-to-blueprintimplementableevent/339640 "2015-11-25T12:21:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![grisevg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@grisevg](https://forums.unrealengine.com/u/grisevg)\
**Post date:** [November 25, 2015, 12:21pm UTC](https://forums.unrealengine.com/t/pass-tassetptr-to-blueprintimplementableevent/339640/1 "2015-11-25T12:21:44Z")

</div>

I can’t seem to find a way to pass `TAssetPtr` into a `BlueprintImplementableEvent`.

Pass-By-Value:

```
UFUNCTION(BlueprintImplementableEvent)
void OnMyEvent(TAssetPtr<UTexture2D> TextureAssetID);

```

Fails with this error:

> MYPROJ.generated.cpp(156): error C2511: ‘void AMYHUD::OnMyEvent(const TAssetPtr &)’: overloaded member function not found in ‘AMYHUD’

Because `MYPROJ.generate.cpp` generated `void AMYHUD::OnMyEvent(const TAssetPtr& TextureAssetID)`

Const-Ref:

```
UFUNCTION(BlueprintImplementableEvent)
void OnMyEvent(const TAssetPtr<UTexture2D>& TextureAssetID);

```

Fails with:

> MYPROJ.generated.cpp(160): error C2678: binary ‘=’: no operator found which takes a left-hand operand of type ‘const TAssetPtr’ (or there is no acceptable conversion)

Cause generated code tries to write into the parameter.

Pass-by-ref compiles but only let’s the parameter to be used like a out parameter, not an input parameter:

```
UFUNCTION(BlueprintImplementableEvent)
void OnMyEvent(TAssetPtr<UTexture2D>& TextureAssetID);

```

I know that Asset IDs should be supported in blueprints since 4.9 and returning an asset id works fine, just passing one is the problem.

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [November 25, 2015, 4:57pm UTC](https://forums.unrealengine.com/t/pass-tassetptr-to-blueprintimplementableevent/339640/2 "2015-11-25T16:57:37Z")

</div>

Reflection system need to define the function and implement code in to it in order for events work in blueprints when you call function in C++. Insted you need to override with “\_Implementation” surrfix in name and i think you need to do BlueprintNativeEvent in order to do so as calling native events from blueprint requires some extra code in reflection system. In base class (with BlueprintNativeEvent) it’s already declered so you need just to define it in cpp file, in child class you need to declere override.

In case of const refrence to fail theres also UPARAM(ref) which inform reflection system that this is suppose to be input refrence pin

```
 UFUNCTION(BlueprintImplementableEvent)
 void OnMyEvent( UPARAM(ref) TAssetPtr<UTexture2D>& TextureAssetID);

```

---

<div class="post-metadata">

**Author:** ![grisevg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@grisevg](https://forums.unrealengine.com/u/grisevg)\
**Post date:** [November 25, 2015, 5:11pm UTC](https://forums.unrealengine.com/t/pass-tassetptr-to-blueprintimplementableevent/339640/3 "2015-11-25T17:11:00Z")

</div>

Thanks! Using `BlueprintNativeEvent` made no difference, but using `UPARAM(ref)` worked!

Still, is it Unreal’s bug that pass-by-value doesn’t work?

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [November 25, 2015, 5:27pm UTC](https://forums.unrealengine.com/t/pass-tassetptr-to-blueprintimplementableevent/339640/4 "2015-11-25T17:27:08Z")

</div>

BlueprintNativeEvent still will define function and you can override it, thats why you got OnMyEvent\_Implementation generated for that.

Pass-by-value should work i think, you passing by refrence 😛

---

<div class="post-metadata">

**Author:** ![grisevg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@grisevg](https://forums.unrealengine.com/u/grisevg)\
**Post date:** [November 25, 2015, 5:29pm UTC](https://forums.unrealengine.com/t/pass-tassetptr-to-blueprintimplementableevent/339640/5 "2015-11-25T17:29:05Z")

</div>

Pass-by-value doesn’t work

UFUNCTION(BlueprintImplementableEvent)  
void OnMyEvent(TAssetPtr TextureAssetID);

> MYPROJ.generated.cpp(156): error C2511: ‘void AMYHUD::OnMyEvent(const TAssetPtr &)’: overloaded member function not found in ‘AMYHUD’

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [November 25, 2015, 5:33pm UTC](https://forums.unrealengine.com/t/pass-tassetptr-to-blueprintimplementableevent/339640/6 "2015-11-25T17:33:18Z")

</div>

Ah sry i misread you quastion a little, so i guess it’s limitation or even a bug

---

<div class="post-metadata">

**Author:** ![grisevg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@grisevg](https://forums.unrealengine.com/u/grisevg)\
**Post date:** [November 25, 2015, 5:38pm UTC](https://forums.unrealengine.com/t/pass-tassetptr-to-blueprintimplementableevent/339640/7 "2015-11-25T17:38:22Z")

</div>

It does look like a bug. I’ll leave the question open for a bit, in hopes that someone from Epic can clarify it.

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [November 26, 2015, 12:10am UTC](https://forums.unrealengine.com/t/pass-tassetptr-to-blueprintimplementableevent/339640/8 "2015-11-26T00:10:41Z")

</div>

At least UHT should show error before compiler get error that non-refrence TAssetPtr argument is not supported if that the case

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [December 2, 2015, 4:47pm UTC](https://forums.unrealengine.com/t/pass-tassetptr-to-blueprintimplementableevent/339640/9 "2015-12-02T16:47:20Z")

</div>

Hi grisevg,

Currently Blueprints do not support passing a TAssetPtr by value in this way. The TAssetPtr would need to be passed by reference, either as a `const` reference or by using the UPARAM macro mentioned by . However, there does seem to be a bug present for passing a TAssetPtr as a `const` reference that is manifested in the generated code. I have submitted a report to have this investigated further (UE-24034).
