Can someone please help to explain the following behavior to me? I’m a career Java developer, so I understand that this question may be hopelessly naive.
When I pass a “fixed” boolean argument into the SetVisibility method of a StaticMesh object, it behaves as documented. However, when I subject the argument to conditional logic, it causes the program to crash. Why is this?
/* This works! */
//This is a UStaticMeshObject pointer to an initialized UStaticMeshComponent
XVox[x].YVox[y].ZVox[z].BVox = PCIP.CreateAbstractDefaultSubobject<UStaticMeshComponent>(this, TFNameFString);
XVox[x].YVox[y].ZVox[z].BVox->SetVisibility(true);
/* This also works! */
bool IsVoxelVisible = true;
XVox[x].YVox[y].ZVox[z].BVox->SetVisibility(IsVoxelVisible);
/* This also works! */
bool IsVoxelVisible = false;
XVox[x].YVox[y].ZVox[z].BVox->SetVisibility(IsVoxelVisible);
/* This causes the UE4 editor to crash when opening the project :( */
bool IsVoxelVisible = (vol[x][y][z] > 0);
XVox[x].YVox[y].ZVox[z].BVox->SetVisibility(IsVoxelVisible);
/* This also causes the UE4 editor to crash */
bool IsVoxelVisible = false;
if(vol[x][y][z] > 0) IsVoxelVisible = true;
XVox[x].YVox[y].ZVox[z].BVox->SetVisibility(IsVoxelVisible);