TSubclassOf

Template to allow [UClass](API\Runtime\CoreUObject\UObject\UClass)'s to be passed around with type safety

Windows
MacOS
Linux

References

Module

CoreUObject

Header

/Engine/Source/Runtime/CoreUObject/Public/Templates/SubclassOf.h

Include

#include "Templates/SubclassOf.h"

Syntax

template<class TClass>
class TSubclassOf

Remarks

Template to allow UClass's to be passed around with type safety

Constructors

Name Description

Public function

TSubclassOf()

Default Constructor, defaults to null

Public function

TSubclassOf

(
    UClass* From
)

Constructor that takes a UClass and does a runtime check to make sure this is a compatible class

Public function

TSubclassOf

(
    const TSubclassOf< TClassA >& From
)

Copy Constructor, will only compile if types are compatible

Functions

Name Description

Public function Const

UClass *

 

DebugAccessRawClassPtr()

This is a DEVELOPMENT ONLY debugging function and should not be relied upon.

Public function Const

UClass *

 

Get()

Dereference back into a UClass

Public function Const

TClass *

 

GetDefaultObject()

Get the CDO if we are referencing a valid class

Operators

Name Description

Public function Const

 

operator UClass *()

Implicit conversion to UClass

Public function Const

UClass *

 

operator*()

Dereference back into a UClass, does runtime type checking

Public function

TSubclassOf ...

 

operator=

(
    const TSubclassOf< TClassA >& From
)

Assignment operator, will only compile if types are compatible

Public function

TSubclassOf ...

 

operator=

(
    UClass* From
)

Assignment operator from UClass, the type is checked on get not on set

Public function Const

UClass *

 

operator->()

Dereference back into a UClass

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback