FloRul
(FloRul)
June 1, 2018, 12:21am
1
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.
Ogniok
(Ogniok)
June 1, 2018, 7:16pm
2
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.
FloRul
(FloRul)
June 2, 2018, 3:12pm
3
Ogniok:
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.