# \#tsubclassof

**URL:** https://forums.unrealengine.com/tag/tsubclassof/4881.md

[Latest](https://forums.unrealengine.com/latest.md) · [Categories](https://forums.unrealengine.com/categories.md) · [Tags](https://forums.unrealengine.com/tags.md)

---

## [Instancing interface to TScriptInterface property](https://forums.unrealengine.com/t/instancing-interface-to-tscriptinterface-property/359013)

<div class="topic-metadata">

**Author:** [@GPSProlapse](https://forums.unrealengine.com/u/GPSProlapse)\
**Replies:** 9\
**Last updated:** [January 21, 2024, 5:13pm UTC](https://forums.unrealengine.com/t/instancing-interface-to-tscriptinterface-property/359013 "2024-01-21T17:13:15Z")

</div>

I have two properties: UPROPERTY() TScriptInterface\<ICoordinateSystem\> CoordinateSystem; UPROPERTY(EditAnywhere) TSubclassOf\<UCoordinateSystem\> CoordinateSystemType; How can I instantiate CoordinateSystemType to Coo…

---

## [Dynamic UActorComponent in C++](https://forums.unrealengine.com/t/dynamic-uactorcomponent-in-c/483001)

<div class="topic-metadata">

**Author:** [@KKochiss](https://forums.unrealengine.com/u/KKochiss)\
**Replies:** 1\
**Last updated:** [May 6, 2021, 7:04pm UTC](https://forums.unrealengine.com/t/dynamic-uactorcomponent-in-c/483001 "2021-05-06T19:04:46Z")

</div>

UPDATE: SOLVED I’m trying to set up my player pawn such that the player can select preferences from their main menu which will help build the player pawn, for instance a movement attribute. I derived the parent movemen…

---

## [Hide Class from TSubclassOf\<\>](https://forums.unrealengine.com/t/hide-class-from-tsubclassof/372517)

<div class="topic-metadata">

**Author:** [@UnexpectedSquirt](https://forums.unrealengine.com/u/UnexpectedSquirt)\
**Replies:** 2\
**Last updated:** [July 13, 2020, 8:08pm UTC](https://forums.unrealengine.com/t/hide-class-from-tsubclassof/372517 "2020-07-13T20:08:08Z")

</div>

Simple enough question. Outside of making a class abstract, is there any way to hide it in the TSubclassOf\<\> UPROPERTY drop downs in the editor? i.e I have a subclass of UCapsuleComponent that I’m using outside of the…

---

## [C++: Spawn and move vehicles (controller-\>car)](https://forums.unrealengine.com/t/c-spawn-and-move-vehicles-controller-car/424237)

<div class="topic-metadata">

**Author:** [@Lunarix\_1](https://forums.unrealengine.com/u/Lunarix_1)\
**Replies:** 5\
**Last updated:** [February 12, 2020, 10:23am UTC](https://forums.unrealengine.com/t/c-spawn-and-move-vehicles-controller-car/424237 "2020-02-12T10:23:20Z")

</div>

Hello, i try to set up a controller → car set up, so that I can control every car in every frame with the controller. My car is driving when it is placed without the controller. It also works for a moving cube(with th…

---

## [Create Variable in C++ pointing to a TSubClassOf a Blueprint](https://forums.unrealengine.com/t/create-variable-in-c-pointing-to-a-tsubclassof-a-blueprint/460955)

<div class="topic-metadata">

**Author:** [@anonymous\_user\_a2fef6c51](https://forums.unrealengine.com/u/anonymous_user_a2fef6c51)\
**Replies:** 2\
**Last updated:** [January 27, 2020, 4:12am UTC](https://forums.unrealengine.com/t/create-variable-in-c-pointing-to-a-tsubclassof-a-blueprint/460955 "2020-01-27T04:12:14Z")

</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\> It…

---

## [Load a TSubclassOf at runtime ?](https://forums.unrealengine.com/t/load-a-tsubclassof-at-runtime/459125)

<div class="topic-metadata">

**Author:** [@Alexandre\_Marie](https://forums.unrealengine.com/u/Alexandre_Marie)\
**Replies:** 1\
**Last updated:** [December 6, 2019, 2:23am UTC](https://forums.unrealengine.com/t/load-a-tsubclassof-at-runtime/459125 "2019-12-06T02:23:08Z")

</div>

Hi everyone, I’m experiencing issues with loading assets, class …etc So let’s make things clearier : I have a custom FDataAsset which contains a TMap, FCustomStruct\> Here is my custom struct : USTRUCT(BlueprintType)…

---

## [Creating an Object based on TSubclassOf & calling a BlueprintNativeEvent](https://forums.unrealengine.com/t/creating-an-object-based-on-tsubclassof-calling-a-blueprintnativeevent/454853)

<div class="topic-metadata">

**Author:** [@Liniran](https://forums.unrealengine.com/u/Liniran)\
**Replies:** 1\
**Last updated:** [September 4, 2019, 9:22pm UTC](https://forums.unrealengine.com/t/creating-an-object-based-on-tsubclassof-calling-a-blueprintnativeevent/454853 "2019-09-04T21:22:02Z")

</div>

Hello everyone, I’m working on a small side project that has RTS controls. When the player clicks on a unit and then clicks on another unit, the unit should perform an action so I thought I would implement an action sys…

---

## [Is TSubclassOf same as UClass\*](https://forums.unrealengine.com/t/is-tsubclassof-same-as-uclass/451920)

<div class="topic-metadata">

**Author:** [@bdgs-mrahman](https://forums.unrealengine.com/u/bdgs-mrahman)\
**Replies:** 1\
**Last updated:** [July 8, 2019, 6:18pm UTC](https://forums.unrealengine.com/t/is-tsubclassof-same-as-uclass/451920 "2019-07-08T18:18:56Z")

</div>

I understand that TSubClassOf is safer to use than UClass\*. But are these both essentially the same?

---

## [Accessing properties of a TSubclassOf without having to instantiate an Object](https://forums.unrealengine.com/t/accessing-properties-of-a-tsubclassof-without-having-to-instantiate-an-object/451024)

<div class="topic-metadata">

**Author:** [@anonymous\_user\_4eae6b42](https://forums.unrealengine.com/u/anonymous_user_4eae6b42)\
**Replies:** 2\
**Last updated:** [June 22, 2019, 12:14pm UTC](https://forums.unrealengine.com/t/accessing-properties-of-a-tsubclassof-without-having-to-instantiate-an-object/451024 "2019-06-22T12:14:53Z")

</div>

Hi guys, i made an Inventory System in my C++ project where I have a class “Item”. My actual items are then blueprint classes derived from my C++ class “Item”, such that I can modify the name and other factors manually …

---

## [Spawn an Actor from a TArray of TsubClassOfs](https://forums.unrealengine.com/t/spawn-an-actor-from-a-tarray-of-tsubclassofs/449157)

<div class="topic-metadata">

**Author:** [@anonymous\_user\_c12ec0981](https://forums.unrealengine.com/u/anonymous_user_c12ec0981)\
**Replies:** 3\
**Last updated:** [June 1, 2019, 1:34pm UTC](https://forums.unrealengine.com/t/spawn-an-actor-from-a-tarray-of-tsubclassofs/449157 "2019-06-01T13:34:25Z")

</div>

I have a TMap of some integer keys and then a TSubclassOf. The TMap will be randomly populated with about 6 subclasses of ‘TaskBase’ meaning they all are different classes with the same parent. After being populated, the…

---

## [TSubclassOf returning null](https://forums.unrealengine.com/t/tsubclassof-returning-null/449896)

<div class="topic-metadata">

**Author:** [@kranatos13](https://forums.unrealengine.com/u/kranatos13)\
**Replies:** 1\
**Last updated:** [June 1, 2019, 6:50am UTC](https://forums.unrealengine.com/t/tsubclassof-returning-null/449896 "2019-06-01T06:50:06Z")

</div>

So I am trying to move my widgets into C++ and a HUD. I have tried watching a tutorial to get this set up though it doesn’t seem to be working for me. I set my widgets in the HUD BP using TSubclassOf and then select them…

---

## [Accessing objects of TSubclassOf](https://forums.unrealengine.com/t/accessing-objects-of-tsubclassof/449535)

<div class="topic-metadata">

**Author:** [@SmokersCough](https://forums.unrealengine.com/u/SmokersCough)\
**Replies:** 2\
**Last updated:** [May 26, 2019, 1:04pm UTC](https://forums.unrealengine.com/t/accessing-objects-of-tsubclassof/449535 "2019-05-26T13:04:12Z")

</div>

Hi Guys, I have a property on my character for apparel, this item is set in blueprints so the designer can set the item to adorn the character with. The code for this in the header file is: UPROPERTY(EditAnywhere, Cate…

---

## [Why use TSubClassOf and not just the class itself?](https://forums.unrealengine.com/t/why-use-tsubclassof-and-not-just-the-class-itself/365690)

<div class="topic-metadata">

**Author:** [@NoobsDeSroobs](https://forums.unrealengine.com/u/NoobsDeSroobs)\
**Replies:** 14\
**Last updated:** [April 5, 2019, 1:25pm UTC](https://forums.unrealengine.com/t/why-use-tsubclassof-and-not-just-the-class-itself/365690 "2019-04-05T13:25:24Z")

</div>

I have read the documentation and I have seen some questions asked regarding TSubClassOf, but none explain what the point of it all is. What extra does it bring? I can write UDamageType\* dmgType = \<some subclass of th…

---

## [Using GetComponentByClass](https://forums.unrealengine.com/t/using-getcomponentbyclass/411844)

<div class="topic-metadata">

**Author:** [@Jakoban](https://forums.unrealengine.com/u/Jakoban)\
**Replies:** 2\
**Last updated:** [February 4, 2019, 7:39am UTC](https://forums.unrealengine.com/t/using-getcomponentbyclass/411844 "2019-02-04T07:39:20Z")

</div>

Whenever I try to use GetComponentByClass I’m hit with some error like type name not allowed or something like that.Can someone just give me a clear example of using GetComponentByClass with UPrimitiveComponent? And what…

---

## [Replicated Tsubclass in PlayerController causes Player State not syncing](https://forums.unrealengine.com/t/replicated-tsubclass-in-playercontroller-causes-player-state-not-syncing/440596)

<div class="topic-metadata">

**Author:** [@JakeTee](https://forums.unrealengine.com/u/JakeTee)\
**Replies:** 2\
**Last updated:** [January 4, 2019, 1:01pm UTC](https://forums.unrealengine.com/t/replicated-tsubclass-in-playercontroller-causes-player-state-not-syncing/440596 "2019-01-04T13:01:28Z")

</div>

Hey guys, I have a really strange problem here that I don’t seem to find a way to solve. Basically, I have a PlayerController class with replicated TSubclass. MyPlayerController.h UPROPERTY(Replicated) TSubcla…

---

## [Prevent Subtype to be used as default](https://forums.unrealengine.com/t/prevent-subtype-to-be-used-as-default/433554)

<div class="topic-metadata">

**Author:** [@ChiefOfMischief](https://forums.unrealengine.com/u/ChiefOfMischief)\
**Replies:** 1\
**Last updated:** [November 30, 2018, 7:47pm UTC](https://forums.unrealengine.com/t/prevent-subtype-to-be-used-as-default/433554 "2018-11-30T19:47:59Z")

</div>

So I can see why this would be not possible but is there a way I can set a class to not show up as a type of subclass in BP defaults? For instance I have class 1,2,3 as a subclass of type A. I have a variable that can …

---

## [TSubclassOf and TSoftClassPtr parameters becomes empty on rebuild project](https://forums.unrealengine.com/t/tsubclassof-and-tsoftclassptr-parameters-becomes-empty-on-rebuild-project/436884)

<div class="topic-metadata">

**Author:** [@yarpoplar](https://forums.unrealengine.com/u/yarpoplar)\
**Replies:** 3\
**Last updated:** [November 2, 2018, 4:06pm UTC](https://forums.unrealengine.com/t/tsubclassof-and-tsoftclassptr-parameters-becomes-empty-on-rebuild-project/436884 "2018-11-02T16:06:09Z")

</div>

Good day! I’ve created custom UStaticMeshComponent called UGunComponent and there I have this: UPROPERTY(BlueprintReadWrite, EditAnywhere) TSoftClassPtr \<class ABaseProjectile\> ProjectileType; I’m using this variable …

---

## [Error missing '\>' in class limitor](https://forums.unrealengine.com/t/error-missing-in-class-limitor/430151)

<div class="topic-metadata">

**Author:** [@Howareyoujay](https://forums.unrealengine.com/u/Howareyoujay)\
**Replies:** 2\
**Last updated:** [July 24, 2018, 6:38pm UTC](https://forums.unrealengine.com/t/error-missing-in-class-limitor/430151 "2018-07-24T18:38:08Z")

</div>

Hi i’m declaring a TArray through a TSubClassOf: TArray\<TSubclassOf\<class AObstacle\*\> \> ObstaclesToSpawn; However when i compile i get Error missing ‘\>’ in class limitor, After searching google the on…

---

## [UPROPERTY is null](https://forums.unrealengine.com/t/uproperty-is-null/429984)

<div class="topic-metadata">

**Author:** [@Vetril](https://forums.unrealengine.com/u/Vetril)\
**Replies:** 0\
**Last updated:** [July 22, 2018, 9:46am UTC](https://forums.unrealengine.com/t/uproperty-is-null/429984 "2018-07-22T09:46:09Z")

</div>

Hi guys, I’m trying to pass to a class that extends UButton a TSubclassOf UPROPERTY that points to a BP class. I then use this UPROPERTY to construct an instance through NewObject. The problem I am having right now is …

---

## [\[C++\] How to get UClass from TSubClassOf\<\>?](https://forums.unrealengine.com/t/c-how-to-get-uclass-from-tsubclassof/379067)

<div class="topic-metadata">

**Author:** [@yarpoplar](https://forums.unrealengine.com/u/yarpoplar)\
**Replies:** 2\
**Last updated:** [March 12, 2018, 1:38am UTC](https://forums.unrealengine.com/t/c-how-to-get-uclass-from-tsubclassof/379067 "2018-03-12T01:38:18Z")

</div>

Here is simple question. How to get UClass from TSubClassOf\<\>? For example I have TSubClassOf\<ACharacter\> TalkActor; But next code doesn’t works: TalkActor-\>GetClass() It’s returning not the right class, which I sel…

---

## [Excluding base class when using "TSubClassOf" on custom UFUNCTION](https://forums.unrealengine.com/t/excluding-base-class-when-using-tsubclassof-on-custom-ufunction/414985)

<div class="topic-metadata">

**Author:** [@Mewster](https://forums.unrealengine.com/u/Mewster)\
**Replies:** 3\
**Last updated:** [January 20, 2018, 12:42pm UTC](https://forums.unrealengine.com/t/excluding-base-class-when-using-tsubclassof-on-custom-ufunction/414985 "2018-01-20T12:42:47Z")

</div>

I have a UFUNCTION that finds the first component subclass of an ActorComponent of an actor UFUNCTION(BlueprintCallable) static UActorComponent\* GetFirstComponentByClass(AActor\* Actor, TSubclassOf\<UActorComponent\> Compo…

---

## [Cannot get GetComponents to work with TSubclassOf](https://forums.unrealengine.com/t/cannot-get-getcomponents-to-work-with-tsubclassof/405149)

<div class="topic-metadata">

**Author:** [@anonymous\_user\_07ba773b](https://forums.unrealengine.com/u/anonymous_user_07ba773b)\
**Replies:** 1\
**Last updated:** [September 21, 2017, 11:56pm UTC](https://forums.unrealengine.com/t/cannot-get-getcomponents-to-work-with-tsubclassof/405149 "2017-09-21T23:56:56Z")

</div>

I have a base class for a component called UBrushDynamicComponent, and various component classes that derive from it. On my actor class, I want to be able to have an array I can iterate over which contains all of the co…

---

## [Blueprint Nativization & TArray of TSubClassOf error](https://forums.unrealengine.com/t/blueprint-nativization-tarray-of-tsubclassof-error/392171)

<div class="topic-metadata">

**Author:** [@zamy](https://forums.unrealengine.com/u/zamy)\
**Replies:** 1\
**Last updated:** [April 28, 2017, 6:26pm UTC](https://forums.unrealengine.com/t/blueprint-nativization-tarray-of-tsubclassof-error/392171 "2017-04-28T18:26:59Z")

</div>

Description When a BlueprintCallable function returns a TArray of TSubclassOf(MyType), the nativization tries to manage it as a TArray of UClass\*, thus failing to assign it to a variable. How to reproduce create a new …

---

## [Blueprint nativization fails if there's any c++ code using TSubclassOf](https://forums.unrealengine.com/t/blueprint-nativization-fails-if-theres-any-c-code-using-tsubclassof/386192)

<div class="topic-metadata">

**Author:** [@moookiexl](https://forums.unrealengine.com/u/moookiexl)\
**Replies:** 4\
**Last updated:** [April 6, 2017, 1:19pm UTC](https://forums.unrealengine.com/t/blueprint-nativization-fails-if-theres-any-c-code-using-tsubclassof/386192 "2017-04-06T13:19:23Z")

</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 su…

---

## [TSubclassOf cause access violation crash in shipping package](https://forums.unrealengine.com/t/tsubclassof-cause-access-violation-crash-in-shipping-package/374212)

<div class="topic-metadata">

**Author:** [@anonymous\_user\_d24c3c621](https://forums.unrealengine.com/u/anonymous_user_d24c3c621)\
**Replies:** 1\
**Last updated:** [October 24, 2016, 12:40pm UTC](https://forums.unrealengine.com/t/tsubclassof-cause-access-violation-crash-in-shipping-package/374212 "2016-10-24T12:40:59Z")

</div>

Hello, I don’t know if my problem is really an Unreal bug but the behavior is quite strange and may be unexpected, so I share it with you in bug reports section in cas of. I use TSubclassOf\<\> in a TArray for an invento…

---

## [Instantiating Blueprint-based components in C++](https://forums.unrealengine.com/t/instantiating-blueprint-based-components-in-c/369836)

<div class="topic-metadata">

**Author:** [@Teiwaz](https://forums.unrealengine.com/u/Teiwaz)\
**Replies:** 6\
**Last updated:** [September 16, 2016, 8:30pm UTC](https://forums.unrealengine.com/t/instantiating-blueprint-based-components-in-c/369836 "2016-09-16T20:30:29Z")

</div>

This seems like it should be a common thing to need to do, but it’s causing me an unreasonable amount of grief. In general, in my project, I’ve been building abstract C++ base classes which are then inherited by bluepri…

---

## [TSubClassOf with Interfaces isn't working](https://forums.unrealengine.com/t/tsubclassof-with-interfaces-isnt-working/344991)

<div class="topic-metadata">

**Author:** [@erebel55](https://forums.unrealengine.com/u/erebel55)\
**Replies:** 15\
**Last updated:** [September 8, 2016, 11:28pm UTC](https://forums.unrealengine.com/t/tsubclassof-with-interfaces-isnt-working/344991 "2016-09-08T23:28:31Z")

</div>

I have the following c++ interface UINTERFACE(Blueprintable) class UActionInterface : public UInterface { GENERATED\_UINTERFACE\_BODY() }; class IActionInterface { GENERATED\_IINTERFACE\_BODY() }; I am then implementing…

---

## [TAssetSubclassOf vs TSubclassOf](https://forums.unrealengine.com/t/tassetsubclassof-vs-tsubclassof/364350)

<div class="topic-metadata">

**Author:** [@anonymous\_user\_f9a538da](https://forums.unrealengine.com/u/anonymous_user_f9a538da)\
**Replies:** 1\
**Last updated:** [July 18, 2016, 10:06am UTC](https://forums.unrealengine.com/t/tassetsubclassof-vs-tsubclassof/364350 "2016-07-18T10:06:49Z")

</div>

What’s the difference and when to use?

---

## [Crash trying to set FP\_Gun](https://forums.unrealengine.com/t/crash-trying-to-set-fp-gun/358162)

<div class="topic-metadata">

**Author:** [@anonymous\_user\_4f79b2b81](https://forums.unrealengine.com/u/anonymous_user_4f79b2b81)\
**Replies:** 3\
**Last updated:** [May 23, 2016, 10:11am UTC](https://forums.unrealengine.com/t/crash-trying-to-set-fp-gun/358162 "2016-05-23T10:11:45Z")

</div>

I want to allow the player to equip multiple types of tools within my game. In the character.h I have a tool, which is a blueprint extended class, and i’ve selected that class in the editor UPROPERTY(EditAnywhere) TSub…

---

## [Help Understanding TSubclassOf\<\> When Spawning](https://forums.unrealengine.com/t/help-understanding-tsubclassof-when-spawning/357934)

<div class="topic-metadata">

**Author:** [@anonymous\_user\_a2c551dd](https://forums.unrealengine.com/u/anonymous_user_a2c551dd)\
**Replies:** 4\
**Last updated:** [May 19, 2016, 3:42pm UTC](https://forums.unrealengine.com/t/help-understanding-tsubclassof-when-spawning/357934 "2016-05-19T15:42:12Z")

</div>

Maybe I’m just not understanding this right, but what is the point of using TSubclassOf ? It seems kind of general… What if I wanted to spawn a specific child class of pickup. I.e. if I have a parent class called pickup …

[Next page](https://forums.unrealengine.com/tag/tsubclassof/4881.md?match_all_tags=true&page=1&tags%5B%5D=tsubclassof)
