Value of in8 changing from 0 to -1 on server.

I have a structure having 2 int8 something like this


USTRUCT()
struct FStorageLoc
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY()
	int8 RowNum;

	UPROPERTY()
	int8 ColNum;

	FStorageLoc()
	{
		RowNum = -1;
		ColNum = -1;
	}

	FStorageLoc(int8 Row, int8 Col)
	{
		RowNum = Row;
		ColNum = Col;
	}
};

I have a client function that calls another server function of the exact same type.


void APSE_LYFE_Inventory2_Storage::StorageSlotLeftClick(const FStorageLoc ItemLoc)
{
	GEngine->AddOnScreenDebugMessage(-1, 10, FColor::Black, "Client " + FString::FromInt(ItemLoc.RowNum) + " " + FString::FromInt(ItemLoc.ColNum));
	Server_StorageSlotLeftClick(ItemLoc);
}

void APSE_LYFE_Inventory2_Storage::Server_StorageSlotLeftClick_Implementation(const FStorageLoc ItemLoc)
{
	GEngine->AddOnScreenDebugMessage(-1, 10, FColor::Blue, " Server " + FString::FromInt(ItemLoc.RowNum) + " "	+ FString::FromInt(ItemLoc.ColNum));
}

The problem is when the values of the structure is 0,0 the values being passed are -1 and -1.

This doesn’t happen for any other values of the structure. Kind of sounds like a huge bug.

After some testing, I found out it takes the default structure values.

E.g. I made the default initializer like this


	FStorageLoc()
	{
		RowNum = -5;
		ColNum = -5;
	}

And the values appear -5, -5 but only for the 0,0 value. Rest values work well.