USpringArmComponent problem

I added SpringArmComponent in my character. But I can’t assign values to variables.


I have already used #include “GameFramework/SpringArmComponent.h” and #include “Camera/CameraComponent.h”.

What am I doing wrong?

*.h file.

#include "CoreMinimal.h"
#include "Characters/Base_Character.h"
#include "Player_Character.generated.h"

class FG_CPP_API APlayer_Character : public ABase_Character

	UPROPERTY(BlueprintReadOnly, VisibleDefaultsOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
		class USpringArmComponent * SpringArm;

*.cpp file

#include "Player_Character.h"
#include "Components/SkeletalMeshComponent.h"
#include "Components/CapsuleComponent.h"
#include "Camera/CameraComponent.h"
#include "GameFramework/SpringArmComponent.h"

// Constructor
	SpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("SpringArm"));
	if (SpringArm)
		SpringArm->RelativeLocation = FVector(-20.f, 0.f, 40.f);

		SpringArm->TargetArmLength = 0.f;
		SpringArm->bDoCollisionTest = false;
		SpringArm->bUsePawnControlRotation = true;
		SpringArm->bInheritPitch = false;
		SpringArm->bInheritRoll = true;
		SpringArm->bInheritYaw = true;

You are doing nothing wrong. The project will actually compile. Those errors are from intellisense because of a bug introduced with unreal 4.20. The bug is already fixed and the fix will be available with 4.20.2 hotfix.

In the meantime you can use the workaround I’ve posted here: VS cannot find generated.h files - C++ - Unreal Engine Forums

It will only fix your code related intellisense errors. It won’t fix the engine ones but will let you work a little bit more comfortable.

Thanks for the reply. I will wait for the next hotfix.