Inside the editor this all runs fine and has zero issue. The crash ONLY occurs in a build or when running as a standalone game. Tested on both linux and windows and it occurs on both. When it crashes it renders the crosshair fine for about 5 minutes then crashes.
[2022.10.21-00.26.20:474][709]LogCore: Error: appError called: Assertion failed: InTexture [File:./Runtime/Engine/Private/UserInterface/CanvasItem.cpp] [Line: 316]
backtrace points to
.../Source/xxxx/Private/ShedHUD.cpp:69
which i simplified to the following and it still occurs
void AShedHUD::BeginPlay()
{
Super::BeginPlay();
cross = LoadObject<UTexture>(GetWorld(), TEXT("/Game/UserInterface/crosshairs/crosshair_default"));
}
void AShedHUD::DrawHUD()
{
Super::DrawHUD();
float x = Canvas->ClipX * 0.5;
float y = Canvas->ClipY * 0.5;
if(cross) {
DrawTextureSimple(cross, x-64, y-64); //line 69
}
}
Very odd to me that it works fine inside the editor but not outside of the editor
Any ideas?