<aside> 🗒️ Part of Ari's Unreal Engine Notes.

</aside>

<aside> ℹ️ This page assumes you know the difference between a Hard and a Soft reference. It will however explain in detail the differences between the different Soft/Weak types of pointers.

</aside>

Weak vs Soft Pointers

A Weak Pointer is created or set to point to an existing UObject that is already instantiated using its GUObjectArray index. The pointer does not need to be a UPROPERTY to know if the object it points to has been garbage collected.

A Soft Pointer is a string representation of a path for an object or asset that may or may not be loaded. It stores an additional Weak Pointer internally to keep track of the object after it has been queried and found (in non-editor builds).

Soft Pointers

<aside> ℹ️ For almost all cases you should use either TSoftObjectPtr or TSoftClassPtr, but an explanation of all related classes are below.

</aside>

FSoftObjectPath

<aside> 🛑 Don't create FSoftObjectPath variables for gameplay code. They don't cache the resolved object so every query will search for the object again. They also point to the blueprint class asset (UBlueprint) instead of the generated class (UBlueprintGeneratedClass, "_C" in the path name). UBlueprint’s get stripped out in packaged builds. Use either TSoftObjectPtr or TSoftClassPtr.

</aside>

 in Instance Details/Class Defaults view.

FSoftObjectPath in Instance Details/Class Defaults view.

Used internally by all types of Soft Pointers. Soft Object Path variables can be created in blueprints but should only be done for editor utilities where know what you’re doing, don’t want to point to the UBlueprintGeneratedClass class, and don’t need caching.

If used in blueprints it will only allow picking on-disk assets, not object instances. To point to instances use TSoftObjectPtr.

It isn't templated. To restrict selection to a type of asset you can use the MetaClass UProperty metadata (or use TSoftClassPtr instead for that kind of functionality).

When objects are being resolved it will search for it using hashes every time, which has an overhead compared to normal or weak pointers. Extending classes will usually cache them so once resolved it won't search again.

FSoftClassPath

Same as FSoftObjectPath but with some helper functions related to loading classes. Mostly a legacy type now. Don't create your own, use TSoftClassPtr instead.

FSoftObjectPtr

The base class for soft -object and -class pointers. Internally keeps an [FSoftObjectPath](<https://flassari.notion.site/Soft-Weak-Pointers-2347eefb694b49fb8314fdd71ca83065>) for finding the object, and a [FWeakObjectPtr](<https://flassari.notion.site/Soft-Weak-Pointers-2347eefb694b49fb8314fdd71ca83065>) for caching it after it's been found.

Extends TPersistentObjectPtr<FSoftObjectPath> where a lot of the functionality resides.