no default constructor exists for class "UCameraShakeBase"

I’m having issues trying to get my camera shake to work, when I make a brand new CameraShakeBase class and start trying to add functionality in the cpp file I get an error under my function about having no “default constructor”. Idk how to fix this if anyone has any idea on how to that would be great.

#pragma once

#include "CoreMinimal.h"
#include "Camera/CameraShakeBase.h"
#include "Pistol_Recoil_Shake.generated.h"

/**
 * 
 */
UCLASS()
class CUBE_RETRO_API UPistol_Recoil_Shake : public UCameraShakeBase
{
	GENERATED_BODY()

public:

	UPistol_Recoil_Shake();
	
};

this is my header ^


#include "Pistol_Recoil_Shake.h"

UPistol_Recoil_Shake::UPistol_Recoil_Shake()
{
}

this is my cpp ^ (also where I’m getting the error)

Hey @Lime_Energy,

When you’re extending UCameraShakeBase , you should use the FObjectInitializer as a parameter for your class’s constructor to correctly initialize the base class.

Your header would be:
UPistol_Recoil_Shake(const FObjectInitializer& ObjectInitializer);

and your CPP would be:

UPistol_Recoil_Shake::UPistol_Recoil_Shake(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { // Code here }

Let me know if this help!

1 Like

Hey I ended up realizing that later but then I ran into another problem with more errors, but I ended up realizing that I needed ULegacyCameraShake not UCameraShakeBase. Thanks for the help tho

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.