March 2019
Intermediate to advanced
708 pages
17h 9m
English
First, we add the declaration of a default constructor:
AMyGameState();
This allows us to set our new member variable to a safe default value of 0 on object initialization:
AMyGameState::AMyGameState()
{
CurrentScore = 0;
}
We use the int32 type when declaring our new variable to ensure portability between the various compilers that Unreal Engine supports. This variable is going to be responsible for storing the current game score while it is running.
As always, we will be marking our variable with UPROPERTY so that it is garbage-collected appropriately. This variable is marked private so that the only way ...
Read now
Unlock full access