I am currently learning more about pointers and read, that UPROPERTY pointers to UObjects are automatically updated to NULL, if the UObject is destroyed and and TWeakObjectPtrs can be checked for validity. I assume normal, raw pointers could potentially become invalid, i.e. point to something other than NULL or a valid object. Are raw pointers therefore dangerous to use, if I store them for some time, so that some other class could delete the UObject the pointer points to? And if so, should I always use UPROPERTY pointers or TWeakObjectPtrs, when I am storing pointers for a short or long duration?
Secondly is it good practice or even possible to use TSharedPtr for UObjects? And what should I do if I need a weak UPROPERTY pointer, that does not prevent garbage collection? Or what if I need a non-UPROPERTY pointer, that prevents garbage collection?