I’m trying to get a sense on how the Touch Input system works in Unreal 4. For that, I thought it would be a nice idea to show some helpers on screen while I develop.
The problem is when I hit play and AHUD::DrawText() is called by PlayerController, Unreal Editor hangs. Its process keeps getting bigger and bigger in RAM usage, and Disk I/O goes up to 100%.
Here’s the relevant code (ANeoPlayerController::InputTouch, in NeoPlayerController.cpp):
else if (Type == ETouchType::Ended)
{
double Milliseconds = (DeviceTimestamp - TouchStartTime).GetTotalMilliseconds();
TouchStartTime = 0;
if (MyHUD)
{
MyHUD->DrawText(FString::SanitizeFloat(Milliseconds),
TouchStartLocation,
MyHUD->GetFontFromSizeIndex(72),
FVector2D(1.f,1.f),
FColor::Red);
MyHUD->Draw2DLine(TouchStartLocation.X,
TouchStartLocation.Y,
TouchLocation.X,
TouchLocation.Y,
FColor::Green);
Debug(TouchStartLocation.ToString(), FColor::Magenta);
}
else Debug(TEXT("HUD was not initialized."));
I think Unreal doesn’t like me calling those functions from PlayerController, but if that was the case shouldn’t they be protected or private?