Im having an issue with my code for the camera crashing my Unreal Editor.
I was able to compile the camera component and test. Once I setup the springarm component, it broke my camera component code somewhere.
I had to delete all the files in my Binary/64 folders and that didnt work. I commented out all the spring arm code and that didnt work. Only when I commented out all the camera code was i able to get the project to get past 71% and open.
Here is the code. If there is anything you can see that might be causing it I’d be grateful.
----------------.h file-----------------------
#pragma once
#include “CoreMinimal.h”
#include “GameFramework/Character.h”
#include “SCharacter.generated.h”
//class UCameraComponent;
UCLASS()
class SILENTRED_API ASCharacter : public ACharacter
{
GENERATED_BODY()
public:
// Sets default values for this character’s properties
ASCharacter();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
void MoveForward(float Value);
void MoveRight(float Value);
//UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components")
//UCameraComponent* CameraComp;
//UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components")
//USpringArmComponent* SpringArmComp;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
};
-------------.CPP file-----------
#include “SCharacter.h”
//#include “Camera/CameraComponent.h”
// Sets default values
ASCharacter::ASCharacter()
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don’t need it.
PrimaryActorTick.bCanEverTick = true;
//CameraComp->bUsePawnControlRotation = true;
//CameraComp = CreateDefaultSubobject<UCameraComponent>(TEXT("CameraComp"));
}
// Called when the game starts or when spawned
void ASCharacter::BeginPlay()
{
Super::BeginPlay();
}
void ASCharacter::MoveForward(float Value)
{
AddMovementInput(GetActorForwardVector() * Value);
}
void ASCharacter::MoveRight(float Value)
{
AddMovementInput(GetActorRightVector() * Value);
}
// Called every frame
void ASCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Called to bind functionality to input
void ASCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis("MoveForward", this, &ASCharacter::MoveForward);
PlayerInputComponent->BindAxis("MoveRight", this, &ASCharacter::MoveRight);
PlayerInputComponent->BindAxis("LookUp", this, &ASCharacter::AddControllerPitchInput);
PlayerInputComponent->BindAxis("Turn", this, &ASCharacter::AddControllerYawInput);
}