Class references: Get Class / Class Is Child Of / Is Valid Class¶
At a glance
Get Class input: a live Object reference · Returns: its runtime Class, or None for no object ·
Class Is Child Of inputs: Test Class and Parent Class · Returns: true for the same class or any subclass; false if either is None ·
Is Valid Class input: a loaded class reference · Returns: whether it is non-None and usable ·
Side effects: none - these nodes inspect references; they do not cast, load, spawn, or create anything ·
Official pages: Get Class,
Class Is Child Of,
and Is Valid Class
The one-minute version¶
- An object reference points to one existing instance: this enemy, this
widget, this data asset. A class reference points to the type/template
used to describe instances:
BP_Guard,WBP_PauseMenu,DA_ItemBase. - Get Class starts with an object instance and returns its actual runtime
class. A
BP_Guard_Eliteinstance returns that generated Blueprint class, even when the input pin is typed only asActor. - Class Is Child Of compares classes, not objects. It returns
truewhenTest ClassequalsParent Classor inherits from it. - Is Valid Class answers only "is this loaded class reference usable?" It does not mean the class is an Actor, concrete, spawnable, allowed by your game rules, or implementing an interface.
- Class variables and pins can be
None. Guard a configurable class before reading defaults or passing it to a spawn/create node. - A soft class reference can name an unloaded class without yielding a loaded class yet. Load it first; these nodes do not cross the async-loading boundary.
Object reference versus class reference¶
Suppose the level contains two guards:
GuardA GuardB
object instance object instance
class = BP_Guard_Elite class = BP_Guard_Elite
Health = 80 Health = 23
GuardA and GuardB are different object references. Their class reference
is the same. The class carries reflected type information, inheritance,
functions, components/templates, and class defaults; each object carries its
own runtime state.
That distinction explains the common node families:
Object -> Get Class -> Class
Object -> Cast To BP_Guard -> same Object, if its class is compatible
Class -> Spawn Actor -> new Object instance, if spawning succeeds
Class -> Get Class Defaults -> default values, not live instance state
A class reference in Blueprint is Unreal's UClass* concept, commonly
restricted in C++ with TSubclassOf<BaseType>. An Actor Class Reference
accepts Actor classes and subclasses; a Damage Type Class Reference accepts
Damage Type classes. That base type makes incompatible choices visibly wrong.
Get Class¶
Get Class asks one live object for the class that created/describes it:
TargetActor (declared pin type = Actor)
actual object = BP_Guard_Elite_C instance
Get Class(TargetActor)
-> BP_Guard_Elite_C class reference
The declared input-pin type does not erase the object's real type. Get Class returns the most-derived runtime class, which may be a native C++ class or a class generated when a Blueprint asset compiled.
For a Blueprint class asset named BP_Guard_Elite, Unreal generates a
UBlueprintGeneratedClass used by instances. Internal paths commonly show a
_C suffix. You normally select the friendly Blueprint class in a picker; do
not build gameplay around parsing _C strings.
If Object is None, there is no class to return, so the result is None.
The node does not find an object, create a class, load a Blueprint asset, or
cast the object.
Common pattern: inspect a found object¶
Hit Actor
-> Is Valid (object)
-> Get Class
-> Class Is Child Of (Parent Class = BP_EnemyBase)
-> Branch
Use this when the class relationship itself is data you need. If the true goal is to call enemy functions on that object, a Cast or Blueprint Interface is usually more direct.
Class Is Child Of¶
This node asks whether one loaded class is in another class's inheritance family:
BP_Guard_Elite -> BP_Guard -> BP_EnemyBase -> Actor
Results:
| Test Class | Parent Class | Result | Why |
|---|---|---|---|
BP_Guard_Elite |
BP_EnemyBase |
true |
Elite guard inherits from enemy base. |
BP_EnemyBase |
BP_EnemyBase |
true |
The test includes exact equality. |
BP_EnemyBase |
BP_Guard_Elite |
false |
A parent is not a child of its descendant. |
WBP_Inventory |
Actor |
false |
Widget and Actor classes are different branches. |
None |
Actor |
false |
Either empty input makes the comparison false. |
"Child of" therefore means same as or derived from, not "strictly below." If you need only the exact class, compare class references for equality:
Get Class(Target) == BP_Guard_Elite
Exact equality rejects child Blueprints. Use it only when inherited variants must intentionally behave differently.
The engine operation is approximately:
pseudocode - not engine source
function ClassIsChildOf(TestClass, ParentClass):
if TestClass is None or ParentClass is None:
return false
walk TestClass, then each superclass
return true if ParentClass appears in that chain
Is Valid Class¶
Is Valid Class returns true when a class reference is non-None and not
being destroyed. It is the class-reference sibling of the object validity
check, but it accepts a Class pin.
Use it before an operation whose class input is configurable or optional:
ProjectileClass variable
-> Is Valid Class
-> Branch
true: Spawn Actor from Class(ProjectileClass)
false: print configuration error; do not spend ammo
Validity is a narrow promise. A valid class may still be:
- outside the parent type your gameplay expected;
- abstract or otherwise not constructible;
- an Object class when Spawn Actor requires an Actor class;
- missing a required interface;
- disallowed by your own item/team/game-mode rules;
- valid locally while the requested spawn is rejected by authority or collision rules.
The class pin's base type should prevent most family mismatches. Use
Class Is Child Of when you receive a broad class and must enforce a narrower
parent at runtime.
When these checks fail (and what failure does)¶
The object or class variable was never assigned¶
Blueprint type is not assignment. An Actor Class Reference variable can
still default to None, just as an Actor object reference can.
Get Class(None object) -> None class
Class Is Child Of(None, Actor) -> false
Is Valid Class(None) -> false
These pure checks have no failure execution pin and no side effects. Branch on their returned value before using the reference.
A soft class is still unloaded¶
A Soft Class Reference stores indirect asset identity. It may be meaningfully
set while its generated UClass is not resident. Converting/dereferencing it
does not make the class appear. Use Async Load Class Asset (or a deliberate
blocking load outside latency-sensitive play), validate the loaded Class in
the completion path, then inspect or spawn it.
The class is valid but creation fails¶
Is Valid Class does not preflight every downstream rule. For Spawn Actor, the class must derive from Actor, be constructible, and survive world/collision and authority conditions. For Create Widget, it must derive from User Widget and needs a valid owning context.
Handle the result of the creation node too. A valid input class and a None
spawn result are not contradictory; they answer different questions.
The test is backwards¶
The order is Test Class, then Parent Class:
"Is BP_Guard_Elite a BP_EnemyBase?"
Test Class = BP_Guard_Elite
Parent Class = BP_EnemyBase
Swapping them asks whether the base inherits from the elite child and returns false.
The pattern everyone actually uses¶
For a class-driven projectile selection:
WeaponData.ProjectileClass // Actor Class Reference, constrained to BP_ProjectileBase
-> Is Valid Class
-> Branch
false:
print "Weapon has no projectile class"
stop before ammo/cooldown mutation
true:
Class Is Child Of(ProjectileClass, BP_ProjectileBase)
-> Branch
false: configuration error
true: Spawn Actor from Class
-> Is Valid returned actor
-> initialize projectile instance
When the variable is already strongly typed as BP_ProjectileBase Class
Reference, the editor enforces the child relationship. The runtime
Class Is Child Of branch is then often redundant; keep the class pin narrow
instead of surrounding every use with defensive checks.
An equivalent C++ shape (original example code) is:
bool CanUseEnemyClass(const UObject* Candidate, TSubclassOf<AEnemyBase> ExpectedBase)
{
if (!Candidate || !ExpectedBase)
{
return false;
}
UClass* ActualClass = Candidate->GetClass();
return ActualClass->IsChildOf(ExpectedBase.Get());
}
Prefer TSubclassOf<AEnemyBase> over a completely unrestricted UClass*
property when the system requires that family.
Class defaults are not instance state¶
Get Class Defaults reads Blueprint-visible default values from the class's Class Default Object (CDO) without spawning an instance. It is useful for a small class-driven catalog:
WeaponClass
-> Get Class Defaults
-> Default Icon / Default Cost / Default Display Name
Those are defaults, not values from a weapon already in the world. Runtime damage, owner, transform, component state, and per-instance overrides require an object reference. Epic also limits which default properties the Blueprint node exposes; do not expect arbitrary object-reference defaults or component templates as writable live objects.
If most of a class exists only to hold definition data, a Data Asset or Data Table may express the design more directly than using class defaults as a database.
Interfaces are a different question¶
Inheritance asks "is this class in that parent chain?" An interface asks "does this type promise this contract?" Unrelated classes can implement the same Blueprint Interface without sharing your gameplay base class.
For a live object, use Does Object Implement Interface before a message
when a visible branch is useful. In C++, class-level reflection uses
UClass::ImplementsInterface. Do not replace an interface contract with a
long list of exact class comparisons.
Lookalikes - which one do I want?¶
| Node/value | Question | Use it when |
|---|---|---|
| Get Class | "What is this existing object's runtime type?" | You have an object and need a class value. |
| Class Is Child Of | "Is this loaded class the parent type or a subclass?" | You are validating class inheritance, including exact equality. |
| Class equality | "Are these exactly the same class?" | Child variants must not count. |
| Is Valid Class | "Is this loaded class reference non-empty and usable?" | Guard a class input; continue validating operation-specific rules. |
| Is Valid (Object) | "Is this live object reference usable?" | You have an instance, not a class. |
| Cast To X | "Is this object an X, and give me the same object typed as X?" | You need instance functions/variables after the check. |
| Does Object Implement Interface | "Can this object receive that contract?" | Unrelated classes share behavior without one parent class. |
| Get Class Defaults | "What are this class's exposed default values?" | You need defaults without creating an instance. |
| Soft Class Reference | "Which class asset should I be able to load later?" | You need deferred loading and can handle a completion boundary. |
| Blueprint asset object | "Which editor asset defines/compiles a Blueprint?" | Editor tooling. Gameplay spawning normally wants its generated class instead. |
Going deeper¶
- The gameplay class hierarchy - why an inherited class satisfies a parent class reference.
- Blueprint variables and references - object, class, and asset reference assignment.
- Soft Object/Class References and async loading - cross from an unloaded Soft Class Reference to a usable loaded class.
- Cast To X - check a live object's type and continue with that same instance.
- Is Valid - the corresponding guard for live object references and pending destruction.
- Spawn Actor from Class - downstream
class constraints, collision handling, and
Nonespawn results. - Blueprint Interfaces - contract checks that do not require one shared gameplay parent.
- Engine source (requires engine access; we do not reproduce it):
UGameplayStatics::GetObjectClassinEngine/Source/Runtime/Engine/Private/GameplayStatics.cpp;UKismetMathLibrary::ClassIsChildOfinEngine/Source/Runtime/Engine/Private/KismetMathLibrary.cpp;UKismetSystemLibrary::IsValidClassinEngine/Source/Runtime/Engine/Private/KismetSystemLibrary.cpp; andUStruct::IsChildOf/UClassinEngine/Source/Runtime/CoreUObject/Private/UObject/Class.cpp.