Download

Initialize of a bool member in override playerStart

Hello,
I override APlayerStart which has no constructor. This class has a member bCanSpawn which is declared and initialized in .h as true.

But whenever I try to read this value for the first time it is always false :


I read this bool for the first time :

Does someone has an improvement to make it work ?
I add the PlayerStart constructor is not overridable because the base class does not have one.

Add a constructor inside your class declaration



ASpherePlayerStart();


Then initialize the variable inside it:



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


You can have a constructor even if a base class doesn’t have one.

Unfortunately it seems I cannot add a constructor and initialize my variable, there is the error C2512 : no appropriate constructor available for the class ASpherePlayerStart.
I searched with google trying to understand how to fix it but I could not find an appropriate answer.