RealDocs

TSoftObjectPtr::UE_SOFTOBJECTPTR_CONVERSION_DEPRECATED (deprecated conversion overloads)

function CoreUObject Deprecated Since 5.5
Deprecated: Constructing TSoftObjectPtr from an incompatible pointer type has been deprecated.
#include "UObject/SoftObjectPtr.h"
Access: public Specifiers: inline

Description

Deprecated conversion constructor selected when U* is not convertible to T*, introduced in UE 5.5 to flag cross-type soft pointer construction that was previously silently allowed. Code that triggers this overload should be fixed to use explicit FSoftObjectPath construction or the correct typed pointer.

Caveats & Gotchas

  • This overload is controlled by the UE_DEPRECATE_SOFTOBJECTPTR_CONVERSIONS preprocessor define (default 1); projects can disable deprecation warnings by setting it to 0, but doing so hides type safety issues.
  • The deprecation affects all TSoftObjectPtr conversions — constructors, assignment operators, and equality comparisons — meaning a single incompatible type pair can generate many deprecation warnings throughout a file.

Signature

UE_SOFTOBJECTPTR_CONVERSION_DEPRECATED(5.5, "Constructing TSoftObjectPtr from an incompatible pointer type has been deprecated.") [[nodiscard]] UE_FORCEINLINE_HINT TSoftObjectPtr(const TSoftObjectPtr<U>& Other)

Parameters

Name Type Description Default
Other const TSoftObjectPtr<U>& The source soft pointer whose type U is NOT implicitly convertible to T.

Example

Code that triggers the deprecated overload C++
// BEFORE (deprecated since 5.5 — UStaticMesh* is not convertible to USkeletalMesh*)
TSoftObjectPtr<UStaticMesh> StaticMeshPtr = SomeMesh;
TSoftObjectPtr<USkeletalMesh> Wrong = StaticMeshPtr; // deprecation warning

// AFTER — explicit path-based construction
FSoftObjectPath Path = StaticMeshPtr.ToSoftObjectPath();
TSoftObjectPtr<USkeletalMesh> Explicit(Path); // no warning, but caller assumes responsibility

Version History

Introduced in: 5.5

Version Status Notes
5.6 deprecated
5.5 deprecated Conversion constructors between incompatible types deprecated.

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.