Whenever I play a scene with this C++ class, the editor crashes. I have found no errors in my code, yet it still crashes with an “EXCEPTION_ACCESS_VIOLATION”. Could someone please explain why this is occurring? Here is the code:
#include "VoxelChunk.h"
AVoxelChunk::AVoxelChunk()
{
PrimaryActorTick.bCanEverTick = true;
}
void AVoxelChunk::BeginPlay()
{
Super::BeginPlay();
for (auto x = 0; x < 15; x++)
{
for (auto y = 0; y < 15; y++)
{
for (auto z = 0; z < 15; z++)
{
chunk[x][y][z] = 1;
}
}
}
// Print contents of chunk array
for (int i = 0; i < sizeof(chunk); i++)
{
GEngine->AddOnScreenDebugMessage(-1, 15.0f,
FColor::Yellow, FString::Printf(TEXT("%lld"), chunk[i]));
}
}