Ue4 generating breackpoints while trying to implement component class

I created a component class appearing in blueprint component tab and I can assign it here, everything is fine. But when I try to call it from my c++ character, compilation goes “UE4Editor.exe has triggered a breakpoint.”

removing this line remove the breackpoint

UPROPERTY(Category = Category, VisibleDefaultsOnly, BlueprintReadOnly)
	TSubobjectPtr<class UMyClass> NameOfMyClass;

Is the synthax incorrect ?

(UPROPERTY(Category = Category, VisibleDefaultsOnly, BlueprintReadOnly)
TSubobjectPtr< class UMyClass> NameOfMyClass;

had to add a space beside TSubObjectPtr< ^!^

A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums

Hey Whag-

We’re trying to reproduce this issue on our end however I will need some additional information from you so we can ensure we are getting the same results. Does the error message say anything else or just that a breakpoint has been triggered? When you created your component class what parent class did you choose to base it on? Also, how are you making the call to the class inside the blueprint? Are the lines of code that you posted above in the c++ character or the component class? Any information you can include regarding the setup will make it easier for us to investigate this problem

Cheers

Doug Wilson

Hi Doug, thanks for answering :wink:

I finally managed to get it works by pacthing knowledge from here and there, my biggest mistake was problably initializing it the wrong way in the constructor. Here is what I did if someone ever asks

I derived from ActorComponent, giving me a class I had to manually link to my pawn, this error message came when i put

      UPROPERTY(Category = Comp, VisibleDefaultsOnly, BlueprintReadOnly)µ
      TSubobjectPtr[class UOF_ColorComponent] ColorComp;

(I replaced <> by [ ] here because things inside disappear)

and tryed to initialize it by following

wich didn’t seems to work ( I am an almost total newb in c++ and programming btw, I might be wrong :wink:

after doing some research I ended with a simple

      AOF_Pawn::AOF_Pawn(const class FPostConstructInitializeProperties& PCIP)
      : Super(PCIP)
      {
      ColorComp = PCIP.CreateDefaultSubobject[UOF_ColorComponent](this, TEXT("ColorComp"));
      }

and #include “OF_ColorComponent” in my header file

it seems to do what I’m looking for so far, inheritance of my component class, I just hope I didn’t miss something for the moment I’ll call it in any functions later.

the breakpoint bug seems to appear when there is nothing (or bad) linked in my pawn constructor while my UPROPERTY stands in the header