Blog

You are filtering on tag 'unreal'. Remove Filters
RSS

No BeginPlay calls in Unreal 4? Here's why.

December 22nd, 2019

Here's a strange and difficult-to-track-down bug that happened to me, so I wanted to share the solution in case someone else who needs it might find it. You're working in Unreal and suddenly none of your actors are receiving BeginPlay. This breaks your game.

If you search for this, you'll find a lot of people who overrode BeginPlay and forgot to include a call to Super (C++) or Parent (Blueprints). That will cause the BeginPlays of that object's parents to not be called, and is definitely a common and subtle bug. But what if it's happening to all your actors, even ones that have no inheriting children?

I only found this in a single YouTube video, which fortunately had the answer - when creating custom Game States or Game Modes, you must consistently inherit from AGameStateBase and AGameModeBase or AGameState and AGameMode. You can't mix and match them, or you will break the code that calls BeginPlay, which lives in the game mode.

Which should you use? According to the header, AGameState and AGameMode are intended for use with match-based multiplayer games. So if you're making one of those, use them, otherwise, use the Base ones.


Permalink


Previous Page
1 posts — page 1 of 1
Next Page