RealDocs

UKismetSystemLibrary::IsObjectOfSoftClass

function Engine Blueprint Since unknown
#include "Kismet/KismetSystemLibrary.h"
Access: public Specifiers: staticBlueprintCallable

Description

Returns true if Object is an instance of SoftClass — either the exact class, a child class, or an implemented interface. Shown in Blueprint as "IsA (soft)" with a boolean exec pin (ExpandEnumAsExecs), functioning as an alternative to Cast that doesn't force a hard reference to the class.

Caveats & Gotchas

  • This resolves/loads SoftClass if it isn't already loaded in order to perform the check, so it can hitch the same way LoadClassAsset_Blocking does — it is not free just because it avoids a hard reference at compile time.
  • Slower than a direct Cast<T> or IsA() check since it goes through soft-path resolution; only use this when you specifically need to avoid a hard class reference (e.g. to keep an unrelated plugin's class out of your module's dependencies).
  • Returns false if Object is null or if SoftClass fails to resolve.

Signature

static bool IsObjectOfSoftClass(const UObject* Object, TSoftClassPtr<UObject> SoftClass)

Parameters

Name Type Description Default
Object const UObject* The object instance to test.
SoftClass TSoftClassPtr<UObject> The soft class to test against.

Return Type

bool

Example

Check an object's class without a hard reference C++
TSoftClassPtr<UObject> SoftEnemyClass = SoftEnemyClassRef;
if (UKismetSystemLibrary::IsObjectOfSoftClass(SomeActor, SoftEnemyClass))
{
    // SomeActor is an instance of (or derives from) the soft-referenced class
}

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.