Running into this error when running PIE mode. This is a project from the PACKT book Unreal Engine 4.X By Example. I’m working inside of UE 4.17.1, and it’s quite obvious to me that this book was written for a fairly early version of UE4. Thus far I have been able to mitigate any issues that have come up with version differences, but this one is stumping me. Thanks in advance for the help.
I’m showing the definition for the floor of the game which is supposed to move past the player character. The second code snippet is the constructor for the floor where I add the 3 different floor meshes to the TArray FloorMeshScenes. And, finally the Tick method where the error is getting thrown.
The error is a read access violation to the gameSpeed member of my custom game mode. But if I place a break point on the AddLocalOffset line, I get “Function UActorComponent::GetWorld has no address, possibly due to compiler optimizations.”
So, it seems to me that I am getting a read access violation because there is something wonky happening with the way I have my FloorMeshScenes set up that’s causing GetWorld() to not work right, or maybe it truly is compiler optimizations and I don’t know how to resolve.
I did a couple of things to resolve this issue. I change the custom game mode to inherit from AGameMode instead of AGameModeBase.
Then, the biggest frustration is the book omitted going into the world settings panel and setting the Game Mode Override to use the custom game mode that it has the reader implement.
I’m following along the same book and the ammount of time I had to stop and debug the code has been frustrating… All I had to do was set the gameMode in my world settings but god ■■■■… Did I spend some time trying to figure it out until I managed to come accross your post. Cheers man, made my evening!
Glad my post has helped someone!
The book certainly is frustration for users of newer version of unreal, but the odd thing is, all things considered, I learned more from the books omissions than from what it actually taught me to do.
I hope the rest of your journey with Unreal and the book goes well!
Cheers
For any future people reading this, I had a similar problem and even though it wasn’t working like Mike described I changed the game mode class to the [PROJECT_NAME]_GameMode in project setting as well as world settings, and not it Is indeed working… Hope this fixes the issue if Mike’s solution doesn’t!