Why can't I declare components

my code:

UPROPERTY(BlueprintReadWrite, VisibleAnywhere, Category = Components)
//class UWidgetInteractionComponent* GetLine;
UWidgetInteractionComponent* GetLine;

this is because your header file is not included simply change it to

     UPROPERTY(BlueprintReadWrite, VisibleAnywhere, Category = Components)
     class UWidgetInteractionComponent* GetLine;

and don’t forget to include Widget.h in your .cpp file also when you work with widgets you have to add “UMG”, “Slate”, “SlateCore” to ModuleRules ad regenerate the visual studio project files and I suggest you do it before you add any widget related code to your project

So you want to create a member variable of the type pointer to UWidgetInteractionComponent? The compiler doesn’t seem to know the UWidgetInteractionComponent class. You can either forward declare it and include the needed header in your cpp file, or you can include the needed header in your VR_Player_Pawn.h

thanks for your answer.I have solved

thanks for your answer.thanks