March 2019
Intermediate to advanced
708 pages
17h 9m
English
GameMode is a special type of actor that is part of the Unreal Game Framework. Your map's GameMode is instantiated by the engine automatically when the game starts.
By placing some code into the BeginPlay method of our custom GameMode, we can run it automatically when the game begins.
Inside BeginPlay, we create an FTransform, which is going to be used by the SpawnActor function. By default, FTransform is constructed to have zero rotation and a location at the origin.
We then get a reference to the current level's UWorld instance using GetWorld, and then we call its SpawnActor function. We pass in FTransform, which we created earlier, to specify that the object should be created at its location, that is, the origin.
Read now
Unlock full access