White crosshair

Hi there,

I followed some tutorials on creating crosshairs, whatever I do, I end up with a white square. Any clue why is that happening?

43153-untitled-1.jpg

Could you post your HUD blueprint, or whatever you’re using to draw the corsshair?

May be your crosshair is white square?
no alpha?

Thank you for your reply, will do once I get back home from work :smiley:

Nope… It isn’t just a white square without an alpha lol

Hello,

Please note that in C++, you can draw the crosshair like this:

AMyHUD::AMyHUD(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
	static ConstructorHelpers::FObjectFinder<UTexture2D> CrosshiarTexObj(TEXT("/*path to the texture*/"));
	CrosshairTex = CrosshiarTexObj.Object;
}


void AMyHUD::DrawHUD()
{
	Super::DrawHUD();

	const FVector2D Center(Canvas->ClipX * 0.5f, Canvas->ClipY * 0.5f);

	const FVector2D CrosshairDrawPosition( (Center.X - (CrosshairTex->GetSurfaceWidth() * 0.5)),
										   (Center.Y - (CrosshairTex->GetSurfaceHeight() * 0.5f)) );

	FCanvasTileItem TileItem( CrosshairDrawPosition, CrosshairTex->Resource, FLinearColor::White);
	TileItem.BlendMode = SE_BLEND_Translucent;
	Canvas->DrawItem( TileItem );
}

Hope this helped!

Cheers!

I never used C++ :frowning:

Here you go sir

You probably imported a .JPG file which isn’t transparent, try importing a .PNG file and see if that works.