Memory Management of local UObject * pointer

I think TSharedPtr doesn’t play well with UObjects. I think FGCObjectScopeGuard is a better choice as stated in the accepted answer.