TSoftObjectPtr::ResetWeakPtr
#include "UObject/SoftObjectPtr.h"
Access: public
Specifiers: inline
Description
Clears only the internal weak object pointer cache without touching the stored soft object path, forcing the next Get() call to re-resolve the path from scratch.
Caveats & Gotchas
- • The path is preserved — IsPending() returns true after this call if the path is non-empty and the object is not currently in memory, making it useful for invalidation without data loss.
- • In a PIE (Play-In-Editor) session, Get() bypasses the cache entirely and always resolves via the path, so calling ResetWeakPtr in PIE has no observable effect on Get() behavior.
Signature
UE_FORCEINLINE_HINT void ResetWeakPtr() Return Type
void Example
Forcing a re-resolve after a rename C++
// Object was renamed/redirected; path still valid but cached ptr is stale
for (TSoftObjectPtr<UDataAsset>& Ref : AllDataAssets)
{
Ref.ResetWeakPtr();
// Next call to Ref.Get() will resolve fresh from the path
} Tags
Version History
Introduced in: 4.17
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?