Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

C++ Function is crashing Unreal...not sure why

$
0
0
As the title says, the function below is crashing the Unreal Engine but I can't understand the reason... I'm pretty sure that the first line is good. But the variable "World" in the second line, if I try to access a public variable of it (like GridHeight in the line below it), the engine immediately crash. I haven't the slightest idea of why... Any guess of what is happening? void UWormHelperFunctions::WorldLocationToGridID(UObject* WorldContextObject, FVector Location, int& Row, int& Column) { UWorld* World = Cast<UWorld>(WorldContextObject); AWormGameMode* GameMode = Cast<AWormGameMode>(World->GetAuthGameMode()); if (GameMode->IsValidLowLevel()) { int RowMiddleID = (GameMode->GridHeight / GameMode->GridBlockSize) / 2; int ColumnMiddleID = (GameMode->GridWidth / GameMode->GridBlockSize) / 2; int GridBlockSize = GameMode->GridBlockSize; ------------------------------------------ Row = -Location.Z / GridBlockSize + RowMiddleID; Column = Location.X / GridBlockSize + ColumnMiddleID; } }

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>