# Create Variable in C++ pointing to a TSubClassOf a Blueprint

**URL:** <https://forums.unrealengine.com/t/create-variable-in-c-pointing-to-a-tsubclassof-a-blueprint/460955>\
**Category:** Blueprint\
**Tags:** tsubclassof, unreal-engine, Blueprint, CPP, question\
**Created:** [January 26, 2020, 5:18pm UTC](https://forums.unrealengine.com/t/create-variable-in-c-pointing-to-a-tsubclassof-a-blueprint/460955 "2020-01-26T17:18:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_a2fef6c51](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a2fef6c51](https://forums.unrealengine.com/u/anonymous_user_a2fef6c51)\
**Post date:** [January 26, 2020, 5:18pm UTC](https://forums.unrealengine.com/t/create-variable-in-c-pointing-to-a-tsubclassof-a-blueprint/460955/1 "2020-01-26T17:18:55Z")

</div>

Gday All,

I want to create a variable in C++ that points to a child of Blueprint Actor Component, something like this;

```
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ItemDetails")
		TSubclassOf<USRAC_Base> ItemClass;

```

But it tells me Class USRAC\_Base is not found ☹

I have tried using ConstructorHelper::ClassFinder, ClassLoad, etc. but nothing seems to work, If anyone can help with this would be awesome, Thanks 🙂

---

<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:** [January 26, 2020, 11:08pm UTC](https://forums.unrealengine.com/t/create-variable-in-c-pointing-to-a-tsubclassof-a-blueprint/460955/2 "2020-01-26T23:08:03Z")

</div>

All blueprint classes exist only virtually on run time, so there data is not accessible during compilation. Because of that you can not use blueprint classes as template arguments, as they don’t formally exist for C++.

You need to create a base C++ class for your blueprint, it can even be empty, just so you can refrence perticilar family of blueprint classes in C++.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a2fef6c51](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a2fef6c51](https://forums.unrealengine.com/u/anonymous_user_a2fef6c51)\
**Post date:** [January 27, 2020, 4:12am UTC](https://forums.unrealengine.com/t/create-variable-in-c-pointing-to-a-tsubclassof-a-blueprint/460955/3 "2020-01-27T04:12:14Z")

</div>

I thought that might be the case, Thanks for confirming 🙂
