Unrecognized Type: TSharedPtr

Hey,

I have a pointer in my class like this:

UPROPERTY(ReplicatedUsing=OnRep_PawnTemplate)
class UB3hPawnTemplate*	mPawnTemplate;

And say I want to make that pointer into a Shared Pointer so I assume I would do something like this:

UPROPERTY(ReplicatedUsing=OnRep_PawnTemplate)
TSharedPtr	mPawnTemplate;

But when I do that I get the following errors (but everything still compiles/links fine):

1> G:/Rocket/B3hGame/Source/B3hGame/Classes/Player/B3hPawn.h(16) : G:/Rocket/B3hGame/Source/B3hGame/Classes/Player/B3hPawn.h(16): Error: In B3hPawn: Unrecognized type ‘TSharedPtr’
1> G:/Rocket/B3hGame/Source/B3hGame/Classes/Player/B3hPlayerController.h(13) : LogCompile:Error: Class ‘B3hPawn’ has no script to compile and is not marked intrinsic - removing from static class registration…

I’ve compiled ExampleGame which uses TSharedPtr’s without this error so I tried to make my B3hGame.h file look like ExampleGame.h as well as the Build.cs file. Is there any reason this error is happening?

Thanks!

1 Like

Actually on further investigation, I’ve realized that a TSharedPtr can’t also be a UProperty which makes sense. :slight_smile:

2 Likes

Right you are!

1 Like

Same problem, give up.

Remove UPROPERTY Macro to get ride of the error, for example

TMap<EInputAction, TSharedPtr<FComboNode>> Children;  //TMap example
TSharedPtr<FMyObjectType> EmptyPointer; // no UPROPERTY Macro