I was shocked when I saw that the #PlayFab #UnrealEngine plugin uses a TSharedPtr<UPlayFabAuthenticationContext>, where the UPlayFabAuthenticationContext is a UObject.
I always thought this to be impossible.
They use this #Hack to make it work:
- First create a TSharedRef<TStrongObjectPtr<UObject>>.
- Then use the aliasing constructor
TSharedPtr(TSharedPtr<OtherType>, ObjectType*) to create a new shared pointer using the Shared Reference as first, and the UObject as second parameter.
#GameDev