Following my previous question, on getting the light levels at the player’s position, I ran into another problem. I want to draw a string in my HUD class to display the results of the visibility function. Unfortunately, when I play in the editor to see the code in action, it crashes. What eludes me is that I do almost the same thing in the tick function of my player character class, except I call AddOnScreenDebugMessage() instead.
I tried replicating the issue you described using your code, but was not able to get the Editor to crash. What version of the Editor are you using, and are you using an Editor compiled from source code or the binary version from the Launcher?
Also, could you specify where and how the variable HUDFont is being declared in your HUD class?
One final thought for now: Have you tried checking for a valid reference to GEngine?
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1, 0.1f, FColor::White, Visibility);
}
I figured out the problem. Turns out, I’m not supposed to cast my player class in the constructor. Instead, I’m now casting it in DrawHUD() and it’s working.