Download

No available constructor after trying to set a member variable

Hello,
I have this problem, I searched for a long time a solution but could not find it.
I have a class that inherit from APlayerStart, I simply want to set a boolean member in but all I can get is the error : C2512 no available constructor.



UCLASS()
class PROJECTIDYEL_API ASpherePlayerStart : public APlayerStart
{
    GENERATED_BODY()

protected:
    UPROPERTY(VisibleAnywhere, Category = SpawnParams)
    bool bCanSpawnPlayer;

public:
    ASpherePlayerStart();
    bool GetCanSpawnPlayer() const;
    void SetCanSpawnPlayer(const bool NewCanSpawnPlayer);
};

And


ASpherePlayerStart::ASpherePlayerStart()
{
    bCanSpawnPlayer = true;
}

bool ASpherePlayerStart::GetCanSpawnPlayer() const
{
    return bCanSpawnPlayer;
}

void ASpherePlayerStart::SetCanSpawnPlayer(const bool NewCanSpawnPlayer)
{
    bCanSpawnPlayer = NewCanSpawnPlayer;
}


Can someone help me ?

The constructor has to match the class it is derived from.
If you do the constructor like this it should work.



ASpherePlayerStart(const FObjectInitializer& ObjectInitializer);

And


ASpherePlayerStart::ASpherePlayerStart(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
bCanSpawnPlayer = true;
}