Converting Hex colors to FColor using built-in capabilities erroneous.

I have no idea what you are doing wrong sorry, I had a quick look at FColor::FromHex() and it contains nothing weird. I tested your two strings with FromHex() and they worked as expected:

FString strHexWith = TEXT("#FED80DFF");
FString strHexWithout = TEXT("FED80DFF");

FColor Colour1 = FColor::FromHex(strHexWith);
FColor Colour2 = FColor::FromHex(strHexWithout);

UE_LOG(LogTraversabilityGraph, Log, TEXT("Colour1 = %s"), *Colour1.ToString());
UE_LOG(LogTraversabilityGraph, Log, TEXT("Colour2 = %s"), *Colour2.ToString());

/*	
	LogTraversabilityGraph: Colour1 = (R=254,G=216,B=13,A=255)
	LogTraversabilityGraph: Colour2 = (R=254,G=216,B=13,A=255)	
*/

You are calling static functions on an instance, which I would consider strange (and undesirable), but there is nothing wrong with it technically and it should work just the same.

:person_shrugging:

1 Like