# Blueprint nativization fails if there's any c++ code using TSubclassOf

**URL:** <https://forums.unrealengine.com/t/blueprint-nativization-fails-if-theres-any-c-code-using-tsubclassof/386192>\
**Category:** Blueprint\
**Tags:** tsubclassof, unreal-engine, bug-report, Blueprint, question\
**Created:** [February 25, 2017, 8:02pm UTC](https://forums.unrealengine.com/t/blueprint-nativization-fails-if-theres-any-c-code-using-tsubclassof/386192 "2017-02-25T20:02:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![moookiexl](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@moookiexl](https://forums.unrealengine.com/u/moookiexl)\
**Post date:** [February 25, 2017, 8:02pm UTC](https://forums.unrealengine.com/t/blueprint-nativization-fails-if-theres-any-c-code-using-tsubclassof/386192/1 "2017-02-25T20:02:59Z")

</div>

Calling any C++ method that has TSubclassOf parameter, or attempting to set any TSubclassOf UPROPERTY both cause blueprint nativization to fail.

From looking at resulting code it appears that blueprint translates all subclass references to UClass\*, and then fails because there’s no conversion from that to TSubclassOf

Here’s a small project that shows the problem: [https://drive.google.com/open?id=0B20tIRBAcOlsTXJnY3UydmNSZGs](https://drive.google.com/open?id=0B20tIRBAcOlsTXJnY3UydmNSZGs)

---

<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:** [February 25, 2017, 8:20pm UTC](https://forums.unrealengine.com/t/blueprint-nativization-fails-if-theres-any-c-code-using-tsubclassof/386192/2 "2017-02-25T20:20:26Z")

</div>

TSubclassOf is just template for UClass\* which prtty much has only cosmetic effect, you can work around this just by using UClass\* insted for now. But it still a bug ofcorse this should not happen, converter probably lose sense of type used in TSubclassOf.

---

<div class="post-metadata">

**Author:** ![moookiexl](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@moookiexl](https://forums.unrealengine.com/u/moookiexl)\
**Post date:** [February 25, 2017, 8:29pm UTC](https://forums.unrealengine.com/t/blueprint-nativization-fails-if-theres-any-c-code-using-tsubclassof/386192/3 "2017-02-25T20:29:21Z")

</div>

Thanks. That’s what I’m doing at the moment, the problem is that this doesn’t specify to BP what classes the method takes, it just accepts anything and it’s rather unwieldy. Is there some alternative way to give a “hint” to BP on what it should or shouldn’t accept?

---

<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:** [March 8, 2017, 11:12pm UTC](https://forums.unrealengine.com/t/blueprint-nativization-fails-if-theres-any-c-code-using-tsubclassof/386192/4 "2017-03-08T23:12:32Z")

</div>

Hi moookiexl,

Thank you for pointing this out. I was able to reproduce the issue using a slightly simplified version of your sample project, and have entered [UE-42676](https://issues.unrealengine.com/issue/UE-42676) to have this investigated further.

---

<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:** [April 6, 2017, 1:19pm UTC](https://forums.unrealengine.com/t/blueprint-nativization-fails-if-theres-any-c-code-using-tsubclassof/386192/5 "2017-04-06T13:19:23Z")

</div>

Hi moookiexl,

Just a quick update on this issue. I wanted to let you know that we have corrected this issue internally, and the fix will be included in a future version of the Engine.
