Looks like the problem here is casting the game mode to your custom game mode in a class that’s also referenced by your game mode! This causes a circular include, which during startup causes the game mode to load the character which causes the character to load the game mode which causes the game mode to… yeah.
So what you need to do is make a blueprint interface that your custom game mode implements and declare the functions you need to call from the game mode in the interface.
Since you need to call InfiniteTerrainGameMode->EnemyKilled() from BP_Character:
- Add EnemyKilled function to your blueprint interface.
- Call EnemyKilled (Message) directly off the GetGameMode node in BP_Character
- Add an event in InfiniteTerrainGameMode for EnemyKilled via Interface
- Have that event call InifiniteTerrainGameMode->EnemyKilled
This will stop the circular include infinite loop.