UKismetSystemLibrary::IsValidClass
#include "Kismet/KismetSystemLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns true if the class is usable: non-null and not pending kill / garbage. The UClass counterpart to IsValid for UObject instances.
Caveats & Gotchas
- • Checks the UClass object itself (the reflection metadata), not whether any instance of that class exists or is valid — don't confuse this with checking an actor/object reference.
- • Also a thin wrapper around ::IsValid(Class); prefer the global template in C++ and reserve this entry point for Blueprint's 'Is Valid Class' node.
Signature
static bool IsValidClass(UClass* Class) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Class | UClass* | The class to check. | — |
Return Type
bool Example
Validate a class reference before spawning C++
if (UKismetSystemLibrary::IsValidClass(ActorClassToSpawn))
{
GetWorld()->SpawnActor<AActor>(ActorClassToSpawn);
} See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?