Hi Guys,
Got another noob C++ question again… I have the below function: that seems to cause it to crash:
UGrid* AGalaxy::GetGrid(const FVector2D &GetLocation, bool CreateIfMissing)
{
int N = (GetLocation.X * GalaxySize) + GetLocation.Y;
UGrid* newGrid = GridLookup[N];
if (!newGrid)
{
if (CreateIfMissing == false) return nullptr;
// create an empty Grid data struct if you need one
GridLookup[N] = NewObject<UGrid>(UGrid::StaticClass());
newGrid = GridLookup[N];
//newGrid->SetGridIndex(GetLocation);
}
return newGrid;
}
Looking at the debug in VS i get the below which i’m guessing means the UGrid object didn’t create properly but I’m not sure. I can post more code if needed but hopefully it’s an obvious error and this is enough. The VS local look like this when it crashed
Any help would be great, thanks!