Editor keeps crashing!

I have been following the book “Learning C++ by Creating Games with UE4” and I have gotten to a point where I am trying to create and NPC within the game.

I have checked and checked and checked that I have used the correct code but if I use this code then it causes the editor to just crash on load up.

This is the code that is causing the issue:

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Collision)
TSubobjectPtr ProxSphere;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = NPCMessage)
FString NpcMessage;

If anyone has any solutions I would be greatly appreciate it.

TSubobjectPtr is depreciated, use a pointer as

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Collision)
class USphereComponent* ProxSphere;

That’s done the trick.

Thank you very much!