Accessing a landscape component texture's raw data always returns null

I’m trying to access the bulkdata in the heightmap of a landscape component, but trying to lock() the data always returns a null pointer.
I’ve checked and the bulkdata is available and unlocked, so I can’t seem to figure out why its not returning anything

Here’s my code:

for (auto& LandscapeComponent : Landscape->LandscapeComponents)
	{
		if (LandscapeComponent->HeightmapTexture)
		{
			FTexturePlatformData& PlatformData = *LandscapeComponent->HeightmapTexture->PlatformData;

			if (PlatformData.Mips.Num())
			{
				FTexture2DMipMap& MyMipMap = PlatformData.Mips[0];

				FColor* FormatedImageData = (FColor*)(MyMipMap.BulkData.Lock(LOCK_READ_ONLY));

				if (FormatedImageData)
				{
					for (int32 X = 0; X < LandscapeComponent->HeightmapTexture->GetSizeX(); X++)
					{
						for (int32 Y = 0; Y < LandscapeComponent->HeightmapTexture->GetSizeY(); Y++)
						{
							NewLandscapeHeightmap.GetRawXY(LandscapeComponent->SectionBaseX + X, LandscapeComponent->SectionBaseY + Y) = FormatedImageData[X + (Y * LandscapeComponent->HeightmapTexture->GetSizeX())].R;
						}
					}
				}
				else
				{
					GEngine->AddOnScreenDebugMessage(INDEX_NONE, 10.f, FColor::Red, FString("Unable to lock the platform data"));
				}

				MyMipMap.BulkData.Unlock();
			}
		}
	}

It always prints out “Unable to lock the platform data”

Try changing the properties of your texture-asset. I think the most important one is “Compression Settings → TC Vector Displacementmap”. Not sure if you also need to set sRGB to false and Mip Gen Settings to NoMipMaps.

Hi there, did you sort that out???

GetSize always gives me 512x512 althought the landscape is much larger. How do I access the complete landscape hightmap?